Made preloadFileStat/preloadCache actually work for FileBackendMultiWrite
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 12 Apr 2014 22:42:34 +0000 (15:42 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 12 Apr 2014 22:42:39 +0000 (15:42 -0700)
* Previously the path substitution did not take place

Change-Id: I58ad3e2aa44a2b08f4c6bad1a783fb92ea79dbf4

includes/filebackend/FileBackend.php
includes/filebackend/FileBackendMultiWrite.php

index 716ab6e..c759725 100644 (file)
@@ -1196,8 +1196,7 @@ abstract class FileBackend {
         *
         * @param array $paths Storage paths
         */
-       public function preloadCache( array $paths ) {
-       }
+       abstract public function preloadCache( array $paths );
 
        /**
         * Invalidate any in-process file stat and property cache.
@@ -1207,8 +1206,7 @@ abstract class FileBackend {
         *
         * @param array $paths Storage paths (optional)
         */
-       public function clearCache( array $paths = null ) {
-       }
+       abstract public function clearCache( array $paths = null );
 
        /**
         * Preload file stat information (concurrently if possible) into in-process cache.
index f00ef65..c39bbaf 100644 (file)
@@ -662,8 +662,14 @@ class FileBackendMultiWrite extends FileBackend {
                }
        }
 
+       public function preloadCache( array $paths ) {
+               $realPaths = $this->substPaths( $paths, $this->backends[$this->masterIndex] );
+               $this->backends[$this->masterIndex]->preloadCache( $realPaths );
+       }
+
        public function preloadFileStat( array $params ) {
-               $this->backends[$this->masterIndex]->preloadFileStat( $params );
+               $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
+               $this->backends[$this->masterIndex]->preloadFileStat( $realParams );
        }
 
        public function getScopedLocksForOps( array $ops, Status $status ) {