[BUGFIX] Cache FileBackend does not respect fileCreateMask
[Packages/TYPO3.CMS.git] / t3lib / cache / backend / class.t3lib_cache_backend_filebackend.php
index f0a5608..578136e 100644 (file)
@@ -274,6 +274,7 @@ class t3lib_cache_backend_FileBackend extends t3lib_cache_backend_AbstractBacken
                $expiryTime = ($lifetime === NULL) ? 0 : ($GLOBALS['EXEC_TIME'] + $lifetime);
                $metaData = str_pad($expiryTime, self::EXPIRYTIME_LENGTH) . implode(' ', $tags) . str_pad(strlen($data), self::DATASIZE_DIGITS);
                $result = file_put_contents($temporaryCacheEntryPathAndFilename, $data . $metaData);
+               t3lib_div::fixPermissions($temporaryCacheEntryPathAndFilename);
 
                if ($result === FALSE) {
                        throw new t3lib_cache_exception(
@@ -412,43 +413,6 @@ class t3lib_cache_backend_FileBackend extends t3lib_cache_backend_AbstractBacken
                return $entryIdentifiers;
        }
 
-       /**
-        * Finds and returns all cache entry identifiers which are tagged by the
-        * specified tags.
-        *
-        * @param array $searchedTags Array of tags to search for
-        * @return array An array with identifiers of all matching entries. An empty array if no entries matched
-        * @author Ingo Renner <ingo@typo3.org>
-        * @author Christian Kuhn <lolli@schwarzbu.ch>
-        * @api
-        */
-       public function findIdentifiersByTags(array $searchedTags) {
-               $entryIdentifiers = array();
-               $now = $GLOBALS['EXEC_TIME'];
-               $cacheEntryFileExtensionLength = strlen($this->cacheEntryFileExtension);
-               for ($directoryIterator = t3lib_div::makeInstance('DirectoryIterator', $this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
-                       if ($directoryIterator->isDot()) {
-                               continue;
-                       }
-                       $cacheEntryPathAndFilename = $directoryIterator->getPathname();
-                       $index = (integer) file_get_contents($cacheEntryPathAndFilename, NULL, NULL, filesize($cacheEntryPathAndFilename) - self::DATASIZE_DIGITS, self::DATASIZE_DIGITS);
-                       $metaData = file_get_contents($cacheEntryPathAndFilename, NULL, NULL, $index);
-
-                       $expiryTime = (integer) substr($metaData, 0, self::EXPIRYTIME_LENGTH);
-                       if ($expiryTime !== 0 && $expiryTime < $now) {
-                               continue;
-                       }
-                       if (in_array($searchedTags, explode(' ', substr($metaData, self::EXPIRYTIME_LENGTH, -self::DATASIZE_DIGITS)))) {
-                               if ($cacheEntryFileExtensionLength > 0) {
-                                       $entryIdentifiers[] = substr($directoryIterator->getFilename(), 0, - $cacheEntryFileExtensionLength);
-                               } else {
-                                       $entryIdentifiers[] = $directoryIterator->getFilename();
-                               }
-                       }
-               }
-               return $entryIdentifiers;
-       }
-
        /**
         * Removes all cache entries of this cache.
         *
@@ -459,6 +423,7 @@ class t3lib_cache_backend_FileBackend extends t3lib_cache_backend_AbstractBacken
         */
        public function flush() {
                t3lib_div::rmdir($this->cacheDirectory, TRUE);
+               $this->createFinalCacheDirectory($this->cacheDirectory);
        }
 
        /**
@@ -481,20 +446,6 @@ class t3lib_cache_backend_FileBackend extends t3lib_cache_backend_AbstractBacken
                }
        }
 
-       /**
-        * Removes all cache entries of this cache which are tagged by the specified tag.
-        *
-        * @param array $tags The tags the entries must have
-        * @return void
-        * @author Ingo Renner <ingo@typo3.org>
-        * @api
-        */
-       public function flushByTags(array $tags) {
-               foreach ($tags as $tag) {
-                       $this->flushByTag($tag);
-               }
-       }
-
        /**
         * Checks if the given cache entry files are still valid or if their
         * lifetime has exceeded.
@@ -576,10 +527,4 @@ class t3lib_cache_backend_FileBackend extends t3lib_cache_backend_AbstractBacken
                return ($this->isCacheFileExpired($pathAndFilename)) ? FALSE : require_once($pathAndFilename);
        }
 }
-
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/cache/backend/class.t3lib_cache_backend_filebackend.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/cache/backend/class.t3lib_cache_backend_filebackend.php']);
-}
-
 ?>
\ No newline at end of file