reset cache not working for Files adapter?

Hello,

first, documentation page doesn't give any description for reset() method, but I assume that calling reset() method should reset metadata cache, in case of Files adapter, this should delete all files, right?.

I have two machines and resetting files metadata cache doesn't work on either of them.

Win7 with PHP 5.5 gives following error:

PHP Fatal error: Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'Meta-Data directory cannot be written' in [no active file]:0 Stack trace: 0 [internal function]: Phalcon\Mvc\Model\MetaData\Files->write('meta-users-user...', Array) 1 [internal function]: Phalcon\Mvc\Model\MetaData->initialize(Object(Users), 'users-users', 'users', NULL) 2 [internal function]: Phalcon\Mvc\Model\MetaData->readMetaDataIndex(Object(Users), 0) 3 [internal function]: Phalcon\Mvc\Model\MetaData->getAttributes(Object(Users)) 4 [internal function]: Phalcon\Mvc\Model->serialize() 5 [internal function]: sessionwriteclose() 6 [internal function]: Phalcon\Session\Adapter->_destruct() 7 {main} thrown in [no active file] on line 0

in this case, session object is destroyed and user is thus logged off (?)

on Linux Debian with PHP 5.4 it doesn't affect the session, but gives something very similar:

PHP Fatal error: Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'Meta-Data directory cannot be written' in [no active file]:0\nStack trace:\n#0 [internal function]: Phalcon\Mvc\Model\MetaData\Files->write('meta-users-user...', Array)\n#1 [internal function]: Phalcon\Mvc\Model\MetaData->_initialize(Object(Users), 'users-users', 'users', NULL)\n#2 [internal function]: Phalcon\Mvc\Model\MetaData->readMetaDataIndex(Object(Users), 0)\n#3 [internal function]: Phalcon\Mvc\Model\MetaData->getAttributes(Object(Users))\n#4 [internal function]: Phalcon\Mvc\Model->serialize()\n#5 {main}\n thrown in [no active file] on line 0, referer: http://10.240.10.96/admin

in any case, no cache file is deleted. And before you ask: file permissions do allow php user to write to metadata directory (how could it create those files in the first place, if it couldn't?)



84.0k

If you're developing the application it's recommended to use Phalcon\Mvc\Model\MetaData\Memory, Phalcon\Mvc\Model\MetaData\Files is only intended for production environments.

http://docs.phalconphp.com/en/latest/reference/models.html#caching-meta-data