summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialMovepage.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialMovepage.php')
-rw-r--r--includes/specials/SpecialMovepage.php77
1 files changed, 43 insertions, 34 deletions
diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php
index 5536fbc9..af3dbf3e 100644
--- a/includes/specials/SpecialMovepage.php
+++ b/includes/specials/SpecialMovepage.php
@@ -141,13 +141,13 @@ class MovePageForm extends UnlistedSpecialPage {
&& $newTitle->quickUserCan( 'delete', $user )
) {
$out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
- $movepagebtn = wfMsg( 'delete_and_move' );
+ $movepagebtn = $this->msg( 'delete_and_move' )->text();
$submitVar = 'wpDeleteAndMove';
$confirm = "
<tr>
<td></td>
<td class='mw-input'>" .
- Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) .
+ Xml::checkLabel( $this->msg( 'delete_and_move_confirm' )->text(), 'wpConfirm', 'wpConfirm' ) .
"</td>
</tr>";
$err = array();
@@ -157,7 +157,7 @@ class MovePageForm extends UnlistedSpecialPage {
}
$out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' :
'movepagetext-noredirectfixer' );
- $movepagebtn = wfMsg( 'movepagebtn' );
+ $movepagebtn = $this->msg( 'movepagebtn' )->text();
$submitVar = 'wpMove';
$confirm = false;
}
@@ -246,14 +246,22 @@ class MovePageForm extends UnlistedSpecialPage {
// Byte limit (not string length limit) for wpReason and wpNewTitleMain
// is enforced in the mediawiki.special.movePage module
+ $immovableNamespaces = array();
+
+ foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
+ if ( !MWNamespace::isMovable( $nsId ) ) {
+ $immovableNamespaces[] = $nsId;
+ }
+ }
+
$out->addHTML(
Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
- Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
+ Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) .
+ Xml::openElement( 'table', array( 'id' => 'mw-movepage-table' ) ) .
"<tr>
<td class='mw-label'>" .
- wfMsgHtml( 'movearticle' ) .
+ $this->msg( 'movearticle' )->escaped() .
"</td>
<td class='mw-input'>
<strong>{$oldTitleLink}</strong>
@@ -261,11 +269,14 @@ class MovePageForm extends UnlistedSpecialPage {
</tr>
<tr>
<td class='mw-label'>" .
- Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) .
+ Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) .
"</td>
<td class='mw-input'>" .
Html::namespaceSelector(
- array( 'selected' => $newTitle->getNamespace() ),
+ array(
+ 'selected' => $newTitle->getNamespace(),
+ 'exclude' => $immovableNamespaces
+ ),
array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' )
) .
Xml::input( 'wpNewTitleMain', 60, $wgContLang->recodeForEdit( $newTitle->getText() ), array(
@@ -278,7 +289,7 @@ class MovePageForm extends UnlistedSpecialPage {
</tr>
<tr>
<td class='mw-label'>" .
- Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
+ Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) .
"</td>
<td class='mw-input'>" .
Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
@@ -292,7 +303,7 @@ class MovePageForm extends UnlistedSpecialPage {
<tr>
<td></td>
<td class='mw-input'>" .
- Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
+ Xml::checkLabel( $this->msg( 'movetalk' )->text(), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
"</td>
</tr>"
);
@@ -303,7 +314,7 @@ class MovePageForm extends UnlistedSpecialPage {
<tr>
<td></td>
<td class='mw-input' >" .
- Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
+ Xml::checkLabel( $this->msg( 'move-leave-redirect' )->text(), 'wpLeaveRedirect',
'wpLeaveRedirect', $this->leaveRedirect ) .
"</td>
</tr>"
@@ -315,7 +326,7 @@ class MovePageForm extends UnlistedSpecialPage {
<tr>
<td></td>
<td class='mw-input' >" .
- Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
+ Xml::checkLabel( $this->msg( 'fix-double-redirects' )->text(), 'wpFixRedirects',
'wpFixRedirects', $this->fixRedirects ) .
"</td>
</tr>"
@@ -335,15 +346,11 @@ class MovePageForm extends UnlistedSpecialPage {
array( 'id' => 'wpMovesubpages' )
) . '&#160;' .
Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
- wfMsgExt(
+ $this->msg(
( $this->oldTitle->hasSubpages()
? 'move-subpages'
- : 'move-talk-subpages' ),
- array( 'parseinline' ),
- $this->getLanguage()->formatNum( $wgMaximumMovedPages ),
- # $2 to allow use of PLURAL in message.
- $wgMaximumMovedPages
- )
+ : 'move-talk-subpages' )
+ )->numParams( $wgMaximumMovedPages )->params( $wgMaximumMovedPages )->parse()
) .
"</td>
</tr>"
@@ -351,14 +358,14 @@ class MovePageForm extends UnlistedSpecialPage {
}
$watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption( 'watchmoves' )
- || $this->oldTitle->userIsWatching());
+ || $user->isWatched( $this->oldTitle ) );
# Don't allow watching if user is not logged in
if( $user->isLoggedIn() ) {
$out->addHTML( "
<tr>
<td></td>
<td class='mw-input'>" .
- Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
+ Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) .
"</td>
</tr>");
}
@@ -384,7 +391,7 @@ class MovePageForm extends UnlistedSpecialPage {
}
function doSubmit() {
- global $wgMaximumMovedPages, $wgFixDoubleRedirects, $wgDeleteRevisionsLimit;
+ global $wgMaximumMovedPages, $wgFixDoubleRedirects;
$user = $this->getUser();
@@ -421,7 +428,7 @@ class MovePageForm extends UnlistedSpecialPage {
return;
}
- $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
+ $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
// Delete an associated image if there is
if ( $nt->getNamespace() == NS_FILE ) {
@@ -433,8 +440,9 @@ class MovePageForm extends UnlistedSpecialPage {
$error = ''; // passed by ref
$page = WikiPage::factory( $nt );
- if ( !$page->doDeleteArticle( $reason, false, 0, true, $error, $user ) ) {
- $this->showForm( array( array( 'cannotdelete', wfEscapeWikiText( $nt->getPrefixedText() ) ) ) );
+ $deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
+ if ( !$deleteStatus->isGood() ) {
+ $this->showForm( $deleteStatus->getErrorsArray() );
return;
}
}
@@ -459,7 +467,7 @@ class MovePageForm extends UnlistedSpecialPage {
wfRunHooks( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
$out = $this->getOutput();
- $out->setPagetitle( wfMsg( 'pagemovedsub' ) );
+ $out->setPageTitle( $this->msg( 'pagemovedsub' ) );
$oldLink = Linker::link(
$ot,
@@ -472,7 +480,7 @@ class MovePageForm extends UnlistedSpecialPage {
$newText = $nt->getPrefixedText();
$msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
- $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink,
+ $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
$newLink )->params( $oldText, $newText )->parseAsBlock() );
$out->addWikiMsg( $msgName );
@@ -562,15 +570,15 @@ class MovePageForm extends UnlistedSpecialPage {
$newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
if( !$newSubpage ) {
$oldLink = Linker::linkKnown( $oldSubpage );
- $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
- htmlspecialchars(Title::makeName( $newNs, $newPageName )));
+ $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink
+ )->params( Title::makeName( $newNs, $newPageName ) )->escaped();
continue;
}
# This was copy-pasted from Renameuser, bleh.
if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
$link = Linker::linkKnown( $newSubpage );
- $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
+ $extraOutput []= $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
} else {
$success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
if( $success === true ) {
@@ -584,16 +592,16 @@ class MovePageForm extends UnlistedSpecialPage {
array( 'redirect' => 'no' )
);
$newLink = Linker::linkKnown( $newSubpage );
- $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
+ $extraOutput []= $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped();
++$count;
if( $count >= $wgMaximumMovedPages ) {
- $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $wgMaximumMovedPages ) );
+ $extraOutput []= $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped();
break;
}
} else {
$oldLink = Linker::linkKnown( $oldSubpage );
$newLink = Linker::link( $newSubpage );
- $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
+ $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped();
}
}
@@ -621,8 +629,9 @@ class MovePageForm extends UnlistedSpecialPage {
}
function showLogFragment( $title ) {
+ $moveLogPage = new LogPage( 'move' );
$out = $this->getOutput();
- $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
+ $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) );
LogEventsList::showLogExtract( $out, 'move', $title );
}