Merge "Ensure users are able to edit the page after changing the content model"
[lhc/web/wiklou.git] / includes / filebackend / FileBackendMultiWrite.php
index 3b20048..52b84d4 100644 (file)
@@ -114,7 +114,7 @@ class FileBackendMultiWrite extends FileBackend {
                        }
                        $name = $config['name'];
                        if ( isset( $namesUsed[$name] ) ) { // don't break FileOp predicates
-                               throw new FileBackendError( "Two or more backends defined with the name $name." );
+                               throw new LogicException( "Two or more backends defined with the name $name." );
                        }
                        $namesUsed[$name] = 1;
                        // Alter certain sub-backend settings for sanity
@@ -124,7 +124,7 @@ class FileBackendMultiWrite extends FileBackend {
                        $config['wikiId'] = $this->wikiId; // use the proxy backend wiki ID
                        if ( !empty( $config['isMultiMaster'] ) ) {
                                if ( $this->masterIndex >= 0 ) {
-                                       throw new FileBackendError( 'More than one master backend defined.' );
+                                       throw new LogicException( 'More than one master backend defined.' );
                                }
                                $this->masterIndex = $index; // this is the "master"
                                $config['fileJournal'] = $this->fileJournal; // log under proxy backend
@@ -134,13 +134,13 @@ class FileBackendMultiWrite extends FileBackend {
                        }
                        // Create sub-backend object
                        if ( !isset( $config['class'] ) ) {
-                               throw new FileBackendError( 'No class given for a backend config.' );
+                               throw new InvalidArgumentException( 'No class given for a backend config.' );
                        }
                        $class = $config['class'];
                        $this->backends[$index] = new $class( $config );
                }
                if ( $this->masterIndex < 0 ) { // need backends and must have a master
-                       throw new FileBackendError( 'No master backend defined.' );
+                       throw new LogicException( 'No master backend defined.' );
                }
                if ( $this->readIndex < 0 ) {
                        $this->readIndex = $this->masterIndex; // default
@@ -148,7 +148,7 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        final protected function doOperationsInternal( array $ops, array $opts ) {
-               $status = Status::newGood();
+               $status = $this->newStatus();
 
                $mbe = $this->backends[$this->masterIndex]; // convenience
 
@@ -233,10 +233,10 @@ class FileBackendMultiWrite extends FileBackend {
         * Check that a set of files are consistent across all internal backends
         *
         * @param array $paths List of storage paths
-        * @return Status
+        * @return StatusValue
         */
        public function consistencyCheck( array $paths ) {
-               $status = Status::newGood();
+               $status = $this->newStatus();
                if ( $this->syncChecks == 0 || count( $this->backends ) <= 1 ) {
                        return $status; // skip checks
                }
@@ -305,10 +305,10 @@ class FileBackendMultiWrite extends FileBackend {
         * Check that a set of file paths are usable across all internal backends
         *
         * @param array $paths List of storage paths
-        * @return Status
+        * @return StatusValue
         */
        public function accessibilityCheck( array $paths ) {
-               $status = Status::newGood();
+               $status = $this->newStatus();
                if ( count( $this->backends ) <= 1 ) {
                        return $status; // skip checks
                }
@@ -331,10 +331,10 @@ class FileBackendMultiWrite extends FileBackend {
         *
         * @param array $paths List of storage paths
         * @param string|bool $resyncMode False, True, or "conservative"; see __construct()
-        * @return Status
+        * @return StatusValue
         */
        public function resyncFiles( array $paths, $resyncMode = true ) {
-               $status = Status::newGood();
+               $status = $this->newStatus();
 
                $mBackend = $this->backends[$this->masterIndex];
                foreach ( $paths as $path ) {
@@ -502,8 +502,8 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        protected function doQuickOperationsInternal( array $ops ) {
-               $status = Status::newGood();
-               // Do the operations on the master backend; setting Status fields...
+               $status = $this->newStatus();
+               // Do the operations on the master backend; setting StatusValue fields...
                $realOps = $this->substOpBatchPaths( $ops, $this->backends[$this->masterIndex] );
                $masterStatus = $this->backends[$this->masterIndex]->doQuickOperations( $realOps );
                $status->merge( $masterStatus );
@@ -553,10 +553,10 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * @param string $method One of (doPrepare,doSecure,doPublish,doClean)
         * @param array $params Method arguments
-        * @return Status
+        * @return StatusValue
         */
        protected function doDirectoryOp( $method, array $params ) {
-               $status = Status::newGood();
+               $status = $this->newStatus();
 
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
                $masterStatus = $this->backends[$this->masterIndex]->$method( $realParams );
@@ -736,7 +736,7 @@ class FileBackendMultiWrite extends FileBackend {
                return $this->backends[$index]->preloadFileStat( $realParams );
        }
 
-       public function getScopedLocksForOps( array $ops, Status $status ) {
+       public function getScopedLocksForOps( array $ops, StatusValue $status ) {
                $realOps = $this->substOpBatchPaths( $ops, $this->backends[$this->masterIndex] );
                $fileOps = $this->backends[$this->masterIndex]->getOperationsInternal( $realOps );
                // Get the paths to lock from the master backend