Merge "[FileBackend] Added getScopedLocksForOps() function."
[lhc/web/wiklou.git] / includes / filerepo / backend / FileBackendMultiWrite.php
index 59406d6..efc6053 100644 (file)
@@ -506,4 +506,20 @@ class FileBackendMultiWrite extends FileBackend {
                        $backend->clearCache( $realPaths );
                }
        }
+
+       /**
+        * @see FileBackend::getScopedLocksForOps()
+        */
+       public function getScopedLocksForOps( array $ops, Status $status ) {
+               $fileOps = $this->backends[$this->masterIndex]->getOperationsInternal( $ops );
+               // Get the paths to lock from the master backend
+               $paths = $this->backends[$this->masterIndex]->getPathsToLockForOpsInternal( $fileOps );
+               // Get the paths under the proxy backend's name
+               $paths['sh'] = $this->unsubstPaths( $paths['sh'] );
+               $paths['ex'] = $this->unsubstPaths( $paths['ex'] );
+               return array(
+                       $this->getScopedFileLocks( $paths['sh'], LockManager::LOCK_UW, $status ),
+                       $this->getScopedFileLocks( $paths['ex'], LockManager::LOCK_EX, $status )
+               );
+       }
 }