Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / filerepo / backend / FileBackendStore.php
index 6c89c45..f02724f 100644 (file)
@@ -564,6 +564,8 @@ abstract class FileBackendStore extends FileBackend {
                        $this->trimCache(); // limit memory
                        $this->cache[$path]['stat'] = $stat;
                        $this->setFileCache( $path, $stat ); // update persistent cache
+               } else {
+                       wfDebug( __METHOD__ . ": File $path does not exist.\n" );
                }
                wfProfileOut( __METHOD__ . '-' . $this->name );
                wfProfileOut( __METHOD__ );
@@ -892,6 +894,18 @@ abstract class FileBackendStore extends FileBackend {
                return $paths;
        }
 
+       /**
+        * @see FileBackend::getScopedLocksForOps()
+        * @return Array
+        */
+       public function getScopedLocksForOps( array $ops, Status $status ) {
+               $paths = $this->getPathsToLockForOpsInternal( $this->getOperationsInternal( $ops ) );
+               return array(
+                       $this->getScopedFileLocks( $paths['sh'], LockManager::LOCK_UW, $status ),
+                       $this->getScopedFileLocks( $paths['ex'], LockManager::LOCK_EX, $status )
+               );
+       }
+
        /**
         * @see FileBackend::doOperationsInternal()
         * @return Status
@@ -947,6 +961,7 @@ abstract class FileBackendStore extends FileBackend {
                wfProfileIn( __METHOD__ . '-' . $this->name );
                $status = Status::newGood();
 
+               $supportedOps = array( 'create', 'store', 'copy', 'move', 'delete', 'null' );
                $async = ( $this->parallelize === 'implicit' );
                $maxConcurrency = $this->concurrency; // throttle
 
@@ -955,12 +970,12 @@ abstract class FileBackendStore extends FileBackend {
                $curFileOpHandles = array(); // current handle batch
                // Perform the sync-only ops and build up op handles for the async ops...
                foreach ( $ops as $index => $params ) {
-                       $method = $params['op'] . 'Internal'; // e.g. "storeInternal"
-                       if ( !MWInit::methodExists( __CLASS__, $method ) ) {
+                       if ( !in_array( $params['op'], $supportedOps ) ) {
                                wfProfileOut( __METHOD__ . '-' . $this->name );
                                wfProfileOut( __METHOD__ );
                                throw new MWException( "Operation '{$params['op']}' is not supported." );
                        }
+                       $method = $params['op'] . 'Internal'; // e.g. "storeInternal"
                        $subStatus = $this->$method( array( 'async' => $async ) + $params );
                        if ( $subStatus->value instanceof FileBackendStoreOpHandle ) { // async
                                if ( count( $curFileOpHandles ) >= $maxConcurrency ) {