Merge "MovePage::move(): Return a Status object"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 16 Sep 2014 22:58:47 +0000 (22:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 16 Sep 2014 22:58:47 +0000 (22:58 +0000)
includes/MovePage.php
includes/Title.php

index 922fe35..fdece8d 100644 (file)
@@ -46,7 +46,7 @@ class MovePage {
         * @param User $user
         * @param string $reason
         * @param bool $createRedirect
-        * @return array|bool True on success, getUserPermissionsErrors()-like array on failure
+        * @return Status
         */
        public function move( User $user, $reason, $createRedirect ) {
                global $wgCategoryCollation;
@@ -59,7 +59,7 @@ class MovePage {
                        if ( $file->exists() ) {
                                $status = $file->move( $this->newTitle );
                                if ( !$status->isOk() ) {
-                                       return $status->getErrorsArray();
+                                       return $status;
                                }
                        }
                        // Clear RepoGroup process cache
@@ -189,7 +189,7 @@ class MovePage {
                $dbw->commit( __METHOD__ );
 
                wfRunHooks( 'TitleMoveComplete', array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) );
-               return true;
+               return Status::newGood();
 
        }
 
index a8d1bb8..8727b74 100644 (file)
@@ -3765,7 +3765,12 @@ class Title {
                wfRunHooks( 'TitleMove', array( $this, $nt, $wgUser ) );
 
                $mp = new MovePage( $this, $nt );
-               return $mp->move( $wgUser, $reason, $createRedirect );
+               $status = $mp->move( $wgUser, $reason, $createRedirect );
+               if ( $status->isOK() ) {
+                       return true;
+               } else {
+                       return $status->getErrorsArray();
+               }
        }
 
        /**