$this->watch = $wgRequest->getCheck( 'wpWatch' );
}
+ /**
+ * Show the form
+ * @param mixed $err Error message. May either be a string message name or
+ * array message name and parameters, like the second argument to
+ * OutputPage::wrapWikiMsg().
+ */
function showForm( $err ) {
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgFixDoubleRedirects;
$skin = $wgUser->getSkin();
# when the form is first opened.
$newTitle = $this->oldTitle;
}
- // WTF is this doing, passing title *object* to newFromUrl()??
- /*else {
+ else {
if( empty($err) ) {
- $nt = Title::newFromURL( $this->newTitle );
- if( $nt ) {
- # If a title was supplied, probably from the move log revert
- # link, check for validity. We can then show some diagnostic
- # information and save a click.
- $newerr = $this->oldTitle->isValidMoveOperation( $nt );
- if( is_string( $newerr ) ) {
- $err = $newerr;
- }
+ # If a title was supplied, probably from the move log revert
+ # link, check for validity. We can then show some diagnostic
+ # information and save a click.
+ $newerr = $this->oldTitle->isValidMoveOperation( $newTitle );
+ if( $newerr ) {
+ $err = $newerr[0];
}
}
- }*/
+ }
if ( !empty($err) && $err[0] == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
$wgOut->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
$considerTalk = ( !$this->oldTitle->isTalkPage() && $oldTalk->exists() );
$dbr = wfGetDB( DB_SLAVE );
- $hasRedirects = $dbr->selectField( 'redirect', '1',
- array(
- 'rd_namespace' => $this->oldTitle->getNamespace(),
- 'rd_title' => $this->oldTitle->getDBkey(),
- ) , __METHOD__ );
-
+ if ( $wgFixDoubleRedirects ) {
+ $hasRedirects = $dbr->selectField( 'redirect', '1',
+ array(
+ 'rd_namespace' => $this->oldTitle->getNamespace(),
+ 'rd_title' => $this->oldTitle->getDBkey(),
+ ) , __METHOD__ );
+ } else {
+ $hasRedirects = false;
+ }
+
if ( $considerTalk ) {
$wgOut->addWikiMsg( 'movepagetalktext' );
}
function doSubmit() {
global $wgOut, $wgUser, $wgRequest, $wgMaximumMovedPages, $wgLang;
+ global $wgFixDoubleRedirects;
if ( $wgUser->pingLimiter( 'move' ) ) {
$wgOut->rateLimited();
$error = $ot->moveTo( $nt, true, $this->reason, $createRedirect );
if ( $error !== true ) {
- call_user_func_array( array($this, 'showForm'), $error );
+ # FIXME: show all the errors in a list, not just the first one
+ $this->showForm( reset( $error ) );
return;
}
- if ( $this->fixRedirects ) {
+ if ( $wgFixDoubleRedirects && $this->fixRedirects ) {
DoubleRedirectJob::fixRedirects( 'move', $ot, $nt );
}