diff -r 5a6b6e770365 -r 68c69c656a2c web/lib/Zend/Cache/Backend/File.php --- a/web/lib/Zend/Cache/Backend/File.php Thu May 07 15:10:09 2015 +0200 +++ b/web/lib/Zend/Cache/Backend/File.php Thu May 07 15:16:02 2015 +0200 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: File.php 24844 2012-05-31 19:01:36Z rob $ + * @version $Id$ */ /** @@ -34,7 +34,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface @@ -120,7 +120,6 @@ * * @param array $options associative array of options * @throws Zend_Cache_Exception - * @return void */ public function __construct(array $options = array()) { @@ -234,10 +233,10 @@ * Note : $data is always "string" (serialization is done by the * core not by the backend) * - * @param string $data Datas to cache - * @param string $id Cache id - * @param array $tags Array of strings, the cache record will be tagged by each string entry - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) + * @param string $data Datas to cache + * @param string $id Cache id + * @param array $tags Array of strings, the cache record will be tagged by each string entry + * @param boolean|int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) * @return boolean true if no problem */ public function save($data, $id, $tags = array(), $specificLifetime = false) @@ -303,7 +302,7 @@ * ($tags can be an array of strings or a single string) * * @param string $mode clean mode - * @param tags array $tags array of tags + * @param array $tags array of tags * @return boolean true if no problem */ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) @@ -675,14 +674,17 @@ // On some systems it is impossible to distinguish between empty match and an error. return true; } + $metadataFiles = array(); foreach ($glob as $file) { if (is_file($file)) { $fileName = basename($file); if ($this->_isMetadatasFile($fileName)) { - // in CLEANING_MODE_ALL, we drop anything, even remainings old metadatas files - if ($mode != Zend_Cache::CLEANING_MODE_ALL) { - continue; + // In CLEANING_MODE_ALL, we drop anything, even remainings old metadatas files. + // To do that, we need to save the list of the metadata files first. + if ($mode == Zend_Cache::CLEANING_MODE_ALL) { + $metadataFiles[] = $file; } + continue; } $id = $this->_fileNameToId($fileName); $metadatas = $this->_getMetadatas($id); @@ -691,12 +693,7 @@ } switch ($mode) { case Zend_Cache::CLEANING_MODE_ALL: - $res = $this->remove($id); - if (!$res) { - // in this case only, we accept a problem with the metadatas file drop - $res = $this->_remove($file); - } - $result = $result && $res; + $result = $result && $this->remove($id); break; case Zend_Cache::CLEANING_MODE_OLD: if (time() > $metadatas['expire']) { @@ -753,6 +750,14 @@ } } } + + // cycle through metadataFiles and delete orphaned ones + foreach ($metadataFiles as $file) { + if (file_exists($file)) { + $result = $this->_remove($file) && $result; + } + } + return $result; } @@ -843,6 +848,7 @@ /** * Compute & return the expire time * + * @param int $lifetime * @return int expire time (unix timestamp) */ protected function _expireTime($lifetime)