$error = $ot->moveTo( $nt, true, $this->reason );
if ( $error !== true ) {
- # FIXME: moveTo() can return a string
- if(is_array($error))
- # FIXME: showForm() should handle multiple errors
- call_user_func_array(array($this, 'showForm'), $error[0]);
- else
- $this->showForm($error);
+ # FIXME: showForm() should handle multiple errors
+ call_user_func_array(array($this, 'showForm'), $error[0]);
return;
}
$this->successCount += $other->successCount;
$this->failCount += $other->failCount;
}
+
+ function getErrorsArray() {
+ $result = array();
+ foreach ( $this->errors as $error ) {
+ if ( $error['type'] == 'error' )
+ $result[] = $error['message'];
+ }
+ return $result;
+ }
}
*/
public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
$err = $this->isValidMoveOperation( $nt, $auth );
- if( is_array($err) ) {
+ if( is_array( $err ) ) {
return $err;
}
$err = $this->moveToNewTitle( $nt, $reason, $createRedirect );
$pageCountChange = ($createRedirect ? 1 : 0);
}
- # FIXME: moveToNewTitle() and moveOverExistingRedirect() return
- # wikitext if a file move goes bad
- if( is_string( $err ) ) {
+
+ if( is_array( $err ) ) {
return $err;
}
$redirid = $this->getArticleID();
$status = $file->move( $nt );
if( !$status->isOk() ) {
$dbw->rollback();
- return $status->getWikiText();
+ return $status->getErrorsArray();
}
}
}
$u = new SquidUpdate( $urls );
$u->doUpdate();
}
+
}
/**
$status = $file->move( $nt );
if( !$status->isOk() ) {
$dbw->rollback();
- return $status->getWikiText();
+ return $status->getErrorsArray();
}
}
}
# Purge old title from squid
# The new title, and links to the new title, are purged in Article::onArticleCreate()
$this->purgeSquid();
+
}
/**
if($retval !== true)
{
# FIXME: Title::moveTo() sometimes returns a string
- if(is_array($retval))
- $this->dieUsageMsg(reset($retval));
- else
- $this->dieUsageMsg(array('unknownerror', $error));
+ $this->dieUsageMsg(reset($retval));
}
$r = array('from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason']);