X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiMove.php;h=20ac48a8a2f89c0620108bd66a17b0cd8d08a91f;hb=580d6f42d9835e5e64477c7f69fcd06787e9297f;hp=3e846e3be33ecd000a1f32bb49b5f2b59e413933;hpb=08b15bcfe6ca638ed6664380b56d78178faa064e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index 3e846e3be3..20ac48a8a2 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -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=Badtitle&to=Goodtitle&token=123ABC&reason=Misspelled%20title&movetalk=&noredirect=' + 'api.php?action=move&from=Badtitle&to=Goodtitle&token=123ABC&' . + 'reason=Misspelled%20title&movetalk=&noredirect=' ); }