From: Aaron Schulz Date: Fri, 20 Jan 2012 21:55:15 +0000 (+0000) Subject: Make sure FSFileBackend clears the php stat cache in clearCache(). Otherwise it will... X-Git-Tag: 1.31.0-rc.0~25157 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=efa202ab2db901d83e0a35429abce8d9ff9bb852;p=lhc%2Fweb%2Fwiklou.git Make sure FSFileBackend clears the php stat cache in clearCache(). Otherwise it will just clear the FileBackend cache and refetch the same cached data from PHP's stat cache. --- diff --git a/includes/filerepo/backend/FSFileBackend.php b/includes/filerepo/backend/FSFileBackend.php index 8aaba700a2..ee390ee18b 100644 --- a/includes/filerepo/backend/FSFileBackend.php +++ b/includes/filerepo/backend/FSFileBackend.php @@ -419,6 +419,13 @@ class FSFileBackend extends FileBackend { } } + /** + * @see FileBackend::doClearCache() + */ + protected function doClearCache( array $paths = null ) { + clearstatcache(); // clear the PHP file stat cache + } + /** * @see FileBackend::getFileListInternal() */ diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index baa18c1485..77018ab765 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -525,7 +525,7 @@ abstract class FileBackendBase { * Invalidate any in-process file existence and property cache. * If $paths is given, then only the cache for those files will be cleared. * - * @param $paths Array Storage paths + * @param $paths Array Storage paths (optional) * @return void */ abstract public function clearCache( array $paths = null ); @@ -1218,8 +1218,19 @@ abstract class FileBackend extends FileBackendBase { unset( $this->cache[$path] ); } } + $this->doClearCache( $paths ); } + /** + * Clears any additional stat caches for storage paths + * + * @see FileBackendBase::clearCache() + * + * @param $paths Array Storage paths (optional) + * @return void + */ + protected function doClearCache( array $paths = null ) {} + /** * Prune the cache if it is too big to add an item *