Merge "[FileBackend] Optimized concatenate() to use getLocalReferenceMulti()."
[lhc/web/wiklou.git] / includes / filebackend / FileBackendMultiWrite.php
index dc9806c..7df09d1 100644 (file)
@@ -572,13 +572,19 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        /**
-        * @see FileBackend::getFileContents()
+        * @see FileBackend::getFileContentsMulti()
         * @param $params array
         * @return bool|string
         */
-       public function getFileContents( array $params ) {
+       public function getFileContentsMulti( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
-               return $this->backends[$this->masterIndex]->getFileContents( $realParams );
+               $contentsM = $this->backends[$this->masterIndex]->getFileContentsMulti( $realParams );
+
+               $contents = array(); // (path => FSFile) mapping using the proxy backend's name
+               foreach ( $contentsM as $path => $data ) {
+                       $contents[$this->unsubstPaths( $path )] = $data;
+               }
+               return $contents;
        }
 
        /**
@@ -612,23 +618,35 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        /**
-        * @see FileBackend::getLocalReference()
+        * @see FileBackend::getLocalReferenceMulti()
         * @param $params array
         * @return FSFile|null
         */
-       public function getLocalReference( array $params ) {
+       public function getLocalReferenceMulti( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
-               return $this->backends[$this->masterIndex]->getLocalReference( $realParams );
+               $fsFilesM = $this->backends[$this->masterIndex]->getLocalReferenceMulti( $realParams );
+
+               $fsFiles = array(); // (path => FSFile) mapping using the proxy backend's name
+               foreach ( $fsFilesM as $path => $fsFile ) {
+                       $fsFiles[$this->unsubstPaths( $path )] = $fsFile;
+               }
+               return $fsFiles;
        }
 
        /**
-        * @see FileBackend::getLocalCopy()
+        * @see FileBackend::getLocalCopyMulti()
         * @param $params array
         * @return null|TempFSFile
         */
-       public function getLocalCopy( array $params ) {
+       public function getLocalCopyMulti( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
-               return $this->backends[$this->masterIndex]->getLocalCopy( $realParams );
+               $tempFilesM = $this->backends[$this->masterIndex]->getLocalCopyMulti( $realParams );
+
+               $tempFiles = array(); // (path => TempFSFile) mapping using the proxy backend's name
+               foreach ( $tempFilesM as $path => $tempFile ) {
+                       $tempFiles[$this->unsubstPaths( $path )] = $tempFile;
+               }
+               return $tempFiles;
        }
 
        /**