Explorar o código

[ZF-7691]Zend_Cache clean() does not work

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17867 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp %!s(int64=16) %!d(string=hai) anos
pai
achega
c7a1a54151
Modificáronse 2 ficheiros con 12 adicións e 10 borrados
  1. 8 6
      library/Zend/Cache/Backend/File.php
  2. 4 4
      library/Zend/Cache/Backend/Sqlite.php

+ 8 - 6
library/Zend/Cache/Backend/File.php

@@ -259,7 +259,9 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
     public function remove($id)
     {
         $file = $this->_file($id);
-        return ($this->_delMetadatas($id) && $this->_remove($file));
+        $boolRemove   = $this->_remove($file);
+        $boolMetadata = $this->_delMetadatas($id);
+        return $boolMetadata && $boolRemove;
     }
 
     /**
@@ -672,7 +674,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
                         break;
                     case Zend_Cache::CLEANING_MODE_OLD:
                         if (time() > $metadatas['expire']) {
-                            $result = ($result) && ($this->remove($id));
+                            $result = $this->remove($id) && $result;
                         }
                         break;
                     case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
@@ -684,7 +686,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
                             }
                         }
                         if ($matching) {
-                            $result = ($result) && ($this->remove($id));
+                            $result = $this->remove($id) && $result;
                         }
                         break;
                     case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
@@ -696,7 +698,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
                             }
                         }
                         if (!$matching) {
-                            $result = ($result) && $this->remove($id);
+                            $result = $this->remove($id) && $result;
                         }
                         break;
                     case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
@@ -708,7 +710,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
                             }
                         }
                         if ($matching) {
-                            $result = ($result) && ($this->remove($id));
+                            $result = $this->remove($id) && $result;
                         }
                         break;
                     default:
@@ -718,7 +720,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
             }
             if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
                 // Recursive call
-                $result = ($result) && ($this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags));
+                $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
                 if ($mode=='all') {
                     // if mode=='all', we try to drop the structure too
                     @rmdir($file);

+ 4 - 4
library/Zend/Cache/Backend/Sqlite.php

@@ -176,7 +176,7 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
         }
         $res = true;
         foreach ($tags as $tag) {
-            $res = $res && $this->_registerTag($id, $tag);
+            $res = $this->_registerTag($id, $tag) && $res;
         }
         return $res;
     }
@@ -630,7 +630,7 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
                 $ids = $this->getIdsMatchingTags($tags);
                 $result = true;
                 foreach ($ids as $id) {
-                    $result = $result && ($this->remove($id));
+                    $result = $this->remove($id) && $result;
                 }
                 return $result;
                 break;
@@ -638,7 +638,7 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
                 $ids = $this->getIdsNotMatchingTags($tags);
                 $result = true;
                 foreach ($ids as $id) {
-                    $result = $result && ($this->remove($id));
+                    $result = $this->remove($id) && $result;
                 }
                 return $result;
                 break;
@@ -646,7 +646,7 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
                 $ids = $this->getIdsMatchingAnyTags($tags);
                 $result = true;
                 foreach ($ids as $id) {
-                    $result = $result && ($this->remove($id));
+                    $result = $this->remove($id) && $result;
                 }
                 return $result;
                 break;