From 2723d302bdcc7129bf147919b0f69b6cc5c638a7 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 19 Mar 2006 04:43:57 +0000 Subject: [PATCH] (bug 3047) Don't mention talk pages on Special:Movepage when there isn't one --- RELEASE-NOTES | 3 ++- includes/SpecialMovepage.php | 45 ++++++++++++++++++------------------ languages/Messages.php | 6 ++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 344548cfe7..6e3bd531e1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -375,7 +375,8 @@ Special Pages: list pages with less than this number of links. Defaults to 1. * (bug 4319) Don't show a "create account" link on the login form when account creation is disabled. -* Javascript filter for Special:Allmessages +* JavaScript filter for Special:Allmessages +* (bug 3047) Don't mention talk pages on Special:Movepage when there isn't one Misc.: * PHP 4.1 compatibility fix: don't use new_link parameter to mysql_connect diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 36ecc31377..4f795c2b81 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -107,7 +107,10 @@ class MovePageForm { $confirm = false; } - if ( !$ot->isTalkPage() ) { + $oldTalk = $ot->getTalkPage(); + $considerTalk = ( !$ot->isTalkPage() && $oldTalk->exists() ); + + if ( $considerTalk ) { $wgOut->addWikiText( wfMsg( 'movepagetalktext' ) ); } @@ -148,7 +151,7 @@ class MovePageForm { " ); - if ( ! $ot->isTalkPage() ) { + if ( $considerTalk ) { $wgOut->addHTML( " @@ -206,28 +209,26 @@ class MovePageForm { wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ot , &$nt ) ) ; - # Move talk page if - # (1) the checkbox says to, - # (2) the namespaces are not themselves talk namespaces, and of course - # (3) it exists. - if ( ( $wgRequest->getVal('wpMovetalk') == 1 ) && - !$ot->isTalkPage() && - !$nt->isTalkPage() ) { - - $ott = $ot->getTalkPage(); - $ntt = $nt->getTalkPage(); - - # Attempt the move - $error = $ott->moveTo( $ntt, true, $this->reason ); - if ( $error === true ) { - $talkmoved = 1; - wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ott , &$ntt ) ) ; + # Move the talk page if relevant, if it exists, and if we've been told to + $ott = $ot->getTalkPage(); + if( $ott->exists() ) { + if( $wgRequest->getVal( 'wpMovetalk' ) == 1 && !$ot->isTalkPage() && !$nt->isTalkPage() ) { + $ntt = $nt->getTalkPage(); + + # Attempt the move + $error = $ott->moveTo( $ntt, true, $this->reason ); + if ( $error === true ) { + $talkmoved = 1; + wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ott , &$ntt ) ) ; + } else { + $talkmoved = $error; + } } else { - $talkmoved = $error; + # Stay silent on the subject of talk. + $talkmoved = ''; } } else { - # Stay silent on the subject of talk. - $talkmoved = ''; + $talkmoved = 'notalkpage'; } # Give back result to user. @@ -263,7 +264,7 @@ class MovePageForm { $wgOut->addWikiText( wfMsg( 'talkexists' ) ); } else { $oldTitle = Title::newFromText( $oldText ); - if ( !$oldTitle->isTalkPage() ) { + if ( !$oldTitle->isTalkPage() && $talkmoved != 'notalkpage' ) { $wgOut->addWikiText( wfMsg( 'talkpagenotmoved', wfMsg( $talkmoved ) ) ); } } diff --git a/languages/Messages.php b/languages/Messages.php index cd01f03222..606c565500 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -1372,11 +1372,9 @@ to move a page.", 'articleexists' => 'A page of that name already exists, or the name you have chosen is not valid. Please choose another name.', -'talkexists' => "'''The page itself was moved successfully, but the -talk page could not be moved because one already exists at the new -title. Please merge them manually.'''", +'talkexists' => "'''The page itself was moved successfully, but the talk page could not be moved because one already exists at the new title. Please merge them manually.'''", 'movedto' => 'moved to', -'movetalk' => 'Move "talk" page as well, if applicable.', +'movetalk' => 'Move associated talk page', 'talkpagemoved' => 'The corresponding talk page was also moved.', 'talkpagenotmoved' => 'The corresponding talk page was not moved.', '1movedto2' => '[[$1]] moved to [[$2]]', -- 2.20.1