From efa202ab2db901d83e0a35429abce8d9ff9bb852 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 20 Jan 2012 21:55:15 +0000 Subject: [PATCH] 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. --- includes/filerepo/backend/FSFileBackend.php | 7 +++++++ includes/filerepo/backend/FileBackend.php | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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 * -- 2.20.1