Kaynağa Gözat

ZF-11343: Hardcoded cleaning mode in Zend_Cache_Backend_File
- applied patch
- updated docblock

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24029 44c647ce-9c0f-0410-b52a-842ac1e357ba

mabe 14 yıl önce
ebeveyn
işleme
45bc341563
1 değiştirilmiş dosya ile 11 ekleme ve 10 silme
  1. 11 10
      library/Zend/Cache/Backend/File.php

+ 11 - 10
library/Zend/Cache/Backend/File.php

@@ -268,14 +268,15 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
      * Clean some cache records
      * Clean some cache records
      *
      *
      * Available modes are :
      * Available modes are :
-     * 'all' (default)  => remove all cache entries ($tags is not used)
-     * 'old'            => remove too old cache entries ($tags is not used)
-     * 'matchingTag'    => remove cache entries matching all given tags
-     *                     ($tags can be an array of strings or a single string)
-     * 'notMatchingTag' => remove cache entries not matching one of the given tags
-     *                     ($tags can be an array of strings or a single string)
-     * 'matchingAnyTag' => remove cache entries matching any given tags
-     *                     ($tags can be an array of strings or a single string)
+     *
+     * Zend_Cache::CLEANING_MODE_ALL (default)    => remove all cache entries ($tags is not used)
+     * Zend_Cache::CLEANING_MODE_OLD              => remove too old cache entries ($tags is not used)
+     * Zend_Cache::CLEANING_MODE_MATCHING_TAG     => remove cache entries matching all given tags
+     *                                               ($tags can be an array of strings or a single string)
+     * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
+     *                                               ($tags can be an array of strings or a single string)
+     * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
+     *                                               ($tags can be an array of strings or a single string)
      *
      *
      * @param string $mode clean mode
      * @param string $mode clean mode
      * @param tags array $tags array of tags
      * @param tags array $tags array of tags
@@ -722,8 +723,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
             if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
             if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
                 // Recursive call
                 // Recursive call
                 $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
                 $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
-                if ($mode=='all') {
-                    // if mode=='all', we try to drop the structure too
+                if ($mode == Zend_Cache::CLEANING_MODE_ALL) {
+                    // we try to drop the structure too
                     @rmdir($file);
                     @rmdir($file);
                 }
                 }
             }
             }