summaryrefslogtreecommitdiff
path: root/includes/SpecialMovepage.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/SpecialMovepage.php')
-rw-r--r--includes/SpecialMovepage.php35
1 files changed, 29 insertions, 6 deletions
diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php
index e33c1530..e3112c4c 100644
--- a/includes/SpecialMovepage.php
+++ b/includes/SpecialMovepage.php
@@ -9,7 +9,7 @@
* Constructor
*/
function wfSpecialMovepage( $par = null ) {
- global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove;
+ global $wgUser, $wgOut, $wgRequest, $action;
# Check rights
if ( !$wgUser->isAllowed( 'move' ) ) {
@@ -49,6 +49,8 @@ function wfSpecialMovepage( $par = null ) {
class MovePageForm {
var $oldTitle, $newTitle, $reason; # Text input
var $moveTalk, $deleteAndMove;
+
+ private $watch = false;
function MovePageForm( $par ) {
global $wgRequest;
@@ -56,8 +58,13 @@ class MovePageForm {
$this->oldTitle = $wgRequest->getText( 'wpOldTitle', $target );
$this->newTitle = $wgRequest->getText( 'wpNewTitle' );
$this->reason = $wgRequest->getText( 'wpReason' );
- $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
+ if ( $wgRequest->wasPosted() ) {
+ $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', false );
+ } else {
+ $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
+ }
$this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
+ $this->watch = $wgRequest->getCheck( 'wpWatch' );
}
function showForm( $err ) {
@@ -126,7 +133,7 @@ class MovePageForm {
$movetalk = wfMsgHtml( 'movetalk' );
$movereason = wfMsgHtml( 'movereason' );
- $titleObj = Title::makeTitle( NS_SPECIAL, 'Movepage' );
+ $titleObj = SpecialPage::getTitleFor( 'Movepage' );
$action = $titleObj->escapeLocalURL( 'action=submit' );
$token = htmlspecialchars( $wgUser->editToken() );
@@ -167,6 +174,14 @@ class MovePageForm {
<td><label for=\"wpMovetalk\">{$movetalk}</label></td>
</tr>" );
}
+
+ $watchChecked = $this->watch || $wgUser->getBoolOption( 'watchmoves' ) || $ot->userIsWatching();
+ $watch = '<tr>';
+ $watch .= '<td align="right">' . Xml::check( 'wpWatch', $watchChecked, array( 'id' => 'watch' ) ) . '</td>';
+ $watch .= '<td>' . Xml::label( wfMsg( 'move-watch' ), 'watch' ) . '</td>';
+ $watch .= '</tr>';
+ $wgOut->addHtml( $watch );
+
$wgOut->addHTML( "
{$confirm}
<tr>
@@ -185,7 +200,6 @@ class MovePageForm {
function doSubmit() {
global $wgOut, $wgUser, $wgRequest;
- $fname = "MovePageForm::doSubmit";
if ( $wgUser->pingLimiter( 'move' ) ) {
$wgOut->rateLimited();
@@ -221,7 +235,7 @@ class MovePageForm {
# 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() ) {
+ if( $this->moveTalk && !$ot->isTalkPage() && !$nt->isTalkPage() ) {
$ntt = $nt->getTalkPage();
# Attempt the move
@@ -239,9 +253,18 @@ class MovePageForm {
} else {
$talkmoved = 'notalkpage';
}
+
+ # Deal with watches
+ if( $this->watch ) {
+ $wgUser->addWatch( $ot );
+ $wgUser->addWatch( $nt );
+ } else {
+ $wgUser->removeWatch( $ot );
+ $wgUser->removeWatch( $nt );
+ }
# Give back result to user.
- $titleObj = Title::makeTitle( NS_SPECIAL, 'Movepage' );
+ $titleObj = SpecialPage::getTitleFor( 'Movepage' );
$success = $titleObj->getFullURL(
'action=success&oldtitle=' . wfUrlencode( $ot->getPrefixedText() ) .
'&newtitle=' . wfUrlencode( $nt->getPrefixedText() ) .