https://www.mediawiki.org/wiki/Special:Code/MediaWiki/109652

Revision: 109652
Author:   aaron
Date:     2012-01-20 21:55:15 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/backend/FSFileBackend.php
    trunk/phase3/includes/filerepo/backend/FileBackend.php

Modified: trunk/phase3/includes/filerepo/backend/FSFileBackend.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/FSFileBackend.php    2012-01-20 
21:46:44 UTC (rev 109651)
+++ trunk/phase3/includes/filerepo/backend/FSFileBackend.php    2012-01-20 
21:55:15 UTC (rev 109652)
@@ -420,6 +420,13 @@
        }
 
        /**
+        * @see FileBackend::doClearCache()
+        */
+       protected function doClearCache( array $paths = null ) {
+               clearstatcache(); // clear the PHP file stat cache
+       }
+
+       /**
         * @see FileBackend::getFileListInternal()
         */
        public function getFileListInternal( $fullCont, $dirRel, array $params 
) {

Modified: trunk/phase3/includes/filerepo/backend/FileBackend.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/FileBackend.php      2012-01-20 
21:46:44 UTC (rev 109651)
+++ trunk/phase3/includes/filerepo/backend/FileBackend.php      2012-01-20 
21:55:15 UTC (rev 109652)
@@ -525,7 +525,7 @@
         * 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,9 +1218,20 @@
                                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
         * 
         * @return void


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to