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' ) ) {
$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
// 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'] ) {
/**
* @param Title $fromTitle
* @param Title $toTitle
- * @param $reason
- * @param $noredirect
+ * @param string $reason
+ * @param bool $noredirect
* @return array
*/
public function moveSubpages( $fromTitle, $toTitle, $reason, $noredirect ) {
$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;
}
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",
'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'
);
}
}
public function getDescription() {
- return 'Move a page';
+ return 'Move a page.';
}
public function getPossibleErrors() {
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='
);
}