Remove unneeded uses of else{} in api/
[lhc/web/wiklou.git] / includes / api / ApiMove.php
index ba1d6c9..20ac48a 100644 (file)
@@ -61,8 +61,8 @@ class ApiMove extends ApiBase {
 
                if ( $toTitle->getNamespace() == NS_FILE
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
-                       && wfFindFile( $toTitle ) )
-               {
+                       && wfFindFile( $toTitle )
+               {
                        if ( !$params['ignorewarnings'] && $user->isAllowed( 'reupload-shared' ) ) {
                                $this->dieUsageMsg( 'sharedfile-exists' );
                        } elseif ( !$user->isAllowed( 'reupload-shared' ) ) {
@@ -77,7 +77,11 @@ class ApiMove extends ApiBase {
                        $this->dieUsageMsg( reset( $retval ) );
                }
 
-               $r = array( 'from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason'] );
+               $r = array(
+                       'from' => $fromTitle->getPrefixedText(),
+                       'to' => $toTitle->getPrefixedText(),
+                       'reason' => $params['reason']
+               );
 
                if ( $fromTitle->exists() ) {
                        //NOTE: we assume that if the old title exists, it's because it was re-created as
@@ -88,7 +92,7 @@ class ApiMove extends ApiBase {
                        $r['redirectcreated'] = '';
                }
 
-               if( $toTitleExists ) {
+               if ( $toTitleExists ) {
                        $r['moveoverredirect'] = '';
                }
 
@@ -99,7 +103,7 @@ class ApiMove extends ApiBase {
                        if ( $retval === true ) {
                                $r['talkfrom'] = $fromTalk->getPrefixedText();
                                $r['talkto'] = $toTalk->getPrefixedText();
-                               if( $toTalkExists ) {
+                               if ( $toTalkExists ) {
                                        $r['talkmoveoverredirect'] = '';
                                }
                        } else {
@@ -115,7 +119,7 @@ class ApiMove extends ApiBase {
                // Move subpages
                if ( $params['movesubpages'] ) {
                        $r['subpages'] = $this->moveSubpages( $fromTitle, $toTitle,
-                                       $params['reason'], $params['noredirect'] );
+                               $params['reason'], $params['noredirect'] );
                        $result->setIndexedTagName( $r['subpages'], 'subpage' );
 
                        if ( $params['movetalk'] ) {
@@ -153,20 +157,21 @@ class ApiMove extends ApiBase {
                $success = $fromTitle->moveSubpages( $toTitle, true, $reason, !$noredirect );
                if ( isset( $success[0] ) ) {
                        return array( 'error' => $this->parseMsg( $success ) );
-               } else {
-                       // At least some pages could be moved
-                       // Report each of them separately
-                       foreach ( $success as $oldTitle => $newTitle ) {
-                               $r = array( 'from' => $oldTitle );
-                               if ( is_array( $newTitle ) ) {
-                                       $r['error'] = $this->parseMsg( reset( $newTitle ) );
-                               } else {
-                                       // Success
-                                       $r['to'] = $newTitle;
-                               }
-                               $retval[] = $r;
+               }
+
+               // At least some pages could be moved
+               // Report each of them separately
+               foreach ( $success as $oldTitle => $newTitle ) {
+                       $r = array( 'from' => $oldTitle );
+                       if ( is_array( $newTitle ) ) {
+                               $r['error'] = $this->parseMsg( reset( $newTitle ) );
+                       } else {
+                               // Success
+                               $r['to'] = $newTitle;
                        }
+                       $retval[] = $r;
                }
+
                return $retval;
        }
 
@@ -219,6 +224,7 @@ class ApiMove extends ApiBase {
 
        public function getParamDescription() {
                $p = $this->getModulePrefix();
+
                return array(
                        'from' => "Title of the page you want to move. Cannot be used together with {$p}fromid",
                        'fromid' => "Page ID of the page you want to move. Cannot be used together with {$p}from",
@@ -230,7 +236,8 @@ class ApiMove extends ApiBase {
                        'noredirect' => 'Don\'t create a redirect',
                        'watch' => 'Add the page and the redirect to your watchlist',
                        'unwatch' => 'Remove the page and the redirect from your watchlist',
-                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+                       'watchlist' => 'Unconditionally add or remove the page from your ' .
+                               'watchlist, use preferences or do not change watch',
                        'ignorewarnings' => 'Ignore any warnings'
                );
        }
@@ -291,7 +298,8 @@ class ApiMove extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=move&from=Exampel&to=Example&token=123ABC&reason=Misspelled%20title&movetalk=&noredirect='
+                       'api.php?action=move&from=Badtitle&to=Goodtitle&token=123ABC&' .
+                               'reason=Misspelled%20title&movetalk=&noredirect='
                );
        }