X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMovepage.php;h=8fa44a0ab210e4f809db88cda822291cb64fb0fe;hb=7d3c428599b3b004848924b1b0a22d55b57500b8;hp=4bca88eab800dd7c59fd33607fffdffb2ba2bb91;hpb=74a21f3bd1692dac958ddf3e09226a72b7bc65b7;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php
index 4bca88eab8..8fa44a0ab2 100644
--- a/includes/specials/SpecialMovepage.php
+++ b/includes/specials/SpecialMovepage.php
@@ -1,103 +1,117 @@
readOnlyPage();
- return;
+ /**
+ * @var Title
+ */
+ var $oldTitle, $newTitle; # Objects
+ var $reason; # Text input
+ var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; # Checks
+
+ private $watch = false;
+
+ public function __construct() {
+ parent::__construct( 'Movepage' );
}
- $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
+ public function execute( $par ) {
+ # Check for database lock
+ if ( wfReadOnly() ) {
+ throw new ReadOnlyError;
+ }
- // Yes, the use of getVal() and getText() is wanted, see bug 20365
- $oldTitleText = $wgRequest->getVal( 'wpOldTitle', $target );
- $newTitleText = $wgRequest->getText( 'wpNewTitle' );
+ $this->setHeaders();
+ $this->outputHeader();
- $oldTitle = Title::newFromText( $oldTitleText );
- $newTitle = Title::newFromText( $newTitleText );
+ $request = $this->getRequest();
+ $target = !is_null( $par ) ? $par : $request->getVal( 'target' );
- if( is_null( $oldTitle ) ) {
- $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
- return;
- }
- if( !$oldTitle->exists() ) {
- $wgOut->showErrorPage( 'nopagetitle', 'nopagetext' );
- return;
- }
+ // Yes, the use of getVal() and getText() is wanted, see bug 20365
+ $oldTitleText = $request->getVal( 'wpOldTitle', $target );
+ $newTitleText = $request->getText( 'wpNewTitle' );
- # Check rights
- $permErrors = $oldTitle->getUserPermissionsErrors( 'move', $wgUser );
- if( !empty( $permErrors ) ) {
- $wgOut->showPermissionsErrorPage( $permErrors );
- return;
- }
+ $this->oldTitle = Title::newFromText( $oldTitleText );
+ $this->newTitle = Title::newFromText( $newTitleText );
- $form = new MovePageForm( $oldTitle, $newTitle );
+ if( is_null( $this->oldTitle ) ) {
+ throw new ErrorPageError( 'notargettitle', 'notargettext' );
+ }
+ if( !$this->oldTitle->exists() ) {
+ throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
+ }
- if ( 'submit' == $action && $wgRequest->wasPosted()
- && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
- $form->doSubmit();
- } else {
- $form->showForm( '' );
- }
-}
+ $user = $this->getUser();
-/**
- * HTML form for Special:Movepage
- * @ingroup SpecialPage
- */
-class MovePageForm {
- var $oldTitle, $newTitle; # Objects
- var $reason; # Text input
- var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; # Checks
+ # Check rights
+ $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user );
+ if( !empty( $permErrors ) ) {
+ $this->getOutput()->showPermissionsErrorPage( $permErrors );
+ return;
+ }
- private $watch = false;
+ $def = !$request->wasPosted();
+
+ $this->reason = $request->getText( 'wpReason' );
+ $this->moveTalk = $request->getBool( 'wpMovetalk', $def );
+ $this->fixRedirects = $request->getBool( 'wpFixRedirects', $def );
+ $this->leaveRedirect = $request->getBool( 'wpLeaveRedirect', $def );
+ $this->moveSubpages = $request->getBool( 'wpMovesubpages', false );
+ $this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' );
+ $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile', false );
+ $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
- function __construct( $oldTitle, $newTitle ) {
- global $wgRequest, $wgUser;
- $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
- $this->oldTitle = $oldTitle;
- $this->newTitle = $newTitle;
- $this->reason = $wgRequest->getText( 'wpReason' );
- if ( $wgRequest->wasPosted() ) {
- $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', false );
- $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', false );
- $this->leaveRedirect = $wgRequest->getBool( 'wpLeaveRedirect', false );
+ if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
+ && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
+ $this->doSubmit();
} else {
- $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
- $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', true );
- $this->leaveRedirect = $wgRequest->getBool( 'wpLeaveRedirect', true );
- }
- $this->moveSubpages = $wgRequest->getBool( 'wpMovesubpages', false );
- $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
- $this->moveOverShared = $wgRequest->getBool( 'wpMoveOverSharedFile', false );
- $this->watch = $wgRequest->getCheck( 'wpWatch' ) && $wgUser->isLoggedIn();
+ $this->showForm( '' );
+ }
}
/**
* 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().
+ *
+ * @param $err Mixed: 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, $wgContLang, $wgFixDoubleRedirects;
+ global $wgContLang, $wgFixDoubleRedirects, $wgMaximumMovedPages;
- $skin = $wgUser->getSkin();
+ $this->getSkin()->setRelevantTitle( $this->oldTitle );
- $oldTitleLink = $skin->link( $this->oldTitle );
+ $oldTitleLink = Linker::link( $this->oldTitle );
- $wgOut->setPagetitle( wfMsg( 'move-page', $this->oldTitle->getPrefixedText() ) );
- $wgOut->setSubtitle( wfMsg( 'move-page-backlink', $oldTitleLink ) );
+ $out = $this->getOutput();
+ $out->setPagetitle( wfMsg( 'move-page', $this->oldTitle->getPrefixedText() ) );
+ $out->addModules( 'mediawiki.special.movePage' );
$newTitle = $this->newTitle;
@@ -118,8 +132,10 @@ class MovePageForm {
}
}
- if ( !empty($err) && $err[0] == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
- $wgOut->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
+ $user = $this->getUser();
+
+ if ( !empty($err) && $err[0] == 'articleexists' && $user->isAllowed( 'delete' ) ) {
+ $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
$movepagebtn = wfMsg( 'delete_and_move' );
$submitVar = 'wpDeleteAndMove';
$confirm = "
@@ -132,27 +148,38 @@ class MovePageForm {
$err = '';
} else {
if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
- $wgOut->wrapWikiMsg( "
\n$1\n
", 'moveuserpage-warning' );
+ $out->wrapWikiMsg( "\n$1\n
", 'moveuserpage-warning' );
}
- $wgOut->addWikiMsg( 'movepagetext' );
+ $out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' :
+ 'movepagetext-noredirectfixer' );
$movepagebtn = wfMsg( 'movepagebtn' );
$submitVar = 'wpMove';
$confirm = false;
}
- if ( !empty($err) && $err[0] == 'file-exists-sharedrepo' && $wgUser->isAllowed( 'reupload-shared' ) ) {
- $wgOut->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
+ if ( !empty($err) && $err[0] == 'file-exists-sharedrepo' && $user->isAllowed( 'reupload-shared' ) ) {
+ $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
$submitVar = 'wpMoveOverSharedFile';
$err = '';
}
-
+
$oldTalk = $this->oldTitle->getTalkPage();
- $considerTalk = ( !$this->oldTitle->isTalkPage() && $oldTalk->exists() );
+ $oldTitleSubpages = $this->oldTitle->hasSubpages();
+ $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
+
+ $canMoveSubpage = ( $oldTitleSubpages || $oldTitleTalkSubpages ) &&
+ !count( $this->oldTitle->getUserPermissionsErrors( 'move-subpages', $user ) );
+
+ # We also want to be able to move assoc. subpage talk-pages even if base page
+ # has no associated talk page, so || with $oldTitleTalkSubpages.
+ $considerTalk = !$this->oldTitle->isTalkPage() &&
+ ( $oldTalk->exists()
+ || ( $oldTitleTalkSubpages && $canMoveSubpage ) );
$dbr = wfGetDB( DB_SLAVE );
if ( $wgFixDoubleRedirects ) {
- $hasRedirects = $dbr->selectField( 'redirect', '1',
- array(
+ $hasRedirects = $dbr->selectField( 'redirect', '1',
+ array(
'rd_namespace' => $this->oldTitle->getNamespace(),
'rd_title' => $this->oldTitle->getDBkey(),
) , __METHOD__ );
@@ -161,20 +188,19 @@ class MovePageForm {
}
if ( $considerTalk ) {
- $wgOut->addWikiMsg( 'movepagetalktext' );
+ $out->addWikiMsg( 'movepagetalktext' );
}
- $titleObj = SpecialPage::getTitleFor( 'Movepage' );
- $token = htmlspecialchars( $wgUser->editToken() );
+ $token = htmlspecialchars( $user->editToken() );
if ( !empty($err) ) {
- $wgOut->setSubtitle( wfMsg( 'formerror' ) );
+ $out->setSubtitle( wfMsg( 'formerror' ) );
if( $err[0] == 'hookaborted' ) {
$hookErr = $err[1];
$errMsg = "$hookErr
\n";
- $wgOut->addHTML( $errMsg );
+ $out->addHTML( $errMsg );
} else {
- $wgOut->wrapWikiMsg( "\n$1\n
", $err );
+ $out->wrapWikiMsg( "\n$1\n
", $err );
}
}
@@ -188,19 +214,19 @@ class MovePageForm {
$noticeMsg = 'protectedpagemovewarning';
$classes[] = 'mw-textarea-protected';
}
- $wgOut->addHTML( "\n" );
- $wgOut->addWikiMsg( $noticeMsg );
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
- $wgOut->addHTML( "
\n" );
+ $out->addHTML( "\n" );
+ $out->addWikiMsg( $noticeMsg );
+ LogEventsList::showLogExtract( $out, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
+ $out->addHTML( "
\n" );
}
- $wgOut->addHTML(
- Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
+ $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' ) ) .
"
- " .
+ | " .
wfMsgHtml( 'movearticle' ) .
" |
@@ -213,7 +239,7 @@ class MovePageForm {
" |
" .
Xml::input( 'wpNewTitle', 40, $wgContLang->recodeForEdit( $newTitle->getPrefixedText() ), array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
- Xml::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
+ Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
" |
@@ -222,13 +248,13 @@ class MovePageForm {
"
" .
Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
- 'maxlength' => 200 ), $this->reason ) .
+ 'maxlength' => 200 ), $this->reason ) . // maxlength byte limit is enforce in mediawiki.special.movePage.js
" |
"
);
if( $considerTalk ) {
- $wgOut->addHTML( "
+ $out->addHTML( "
|
" .
@@ -238,12 +264,12 @@ class MovePageForm {
);
}
- if ( $wgUser->isAllowed( 'suppressredirect' ) ) {
- $wgOut->addHTML( "
+ if ( $user->isAllowed( 'suppressredirect' ) ) {
+ $out->addHTML( "
|
|
" .
- Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
+ Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
'wpLeaveRedirect', $this->leaveRedirect ) .
" |
"
@@ -251,23 +277,19 @@ class MovePageForm {
}
if ( $hasRedirects ) {
- $wgOut->addHTML( "
+ $out->addHTML( "
|
" .
- Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
+ Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
'wpFixRedirects', $this->fixRedirects ) .
" |
"
);
}
- if( ($this->oldTitle->hasSubpages() || $this->oldTitle->getTalkPage()->hasSubpages())
- && $this->oldTitle->userCan( 'move-subpages' ) )
- {
- global $wgMaximumMovedPages, $wgLang;
-
- $wgOut->addHTML( "
+ if( $canMoveSubpage ) {
+ $out->addHTML( "
|
" .
@@ -284,7 +306,7 @@ class MovePageForm {
? 'move-subpages'
: 'move-talk-subpages' ),
array( 'parseinline' ),
- $wgLang->formatNum( $wgMaximumMovedPages ),
+ $this->getLang()->formatNum( $wgMaximumMovedPages ),
# $2 to allow use of PLURAL in message.
$wgMaximumMovedPages
)
@@ -294,11 +316,11 @@ class MovePageForm {
);
}
- $watchChecked = $wgUser->isLoggedIn() && ($this->watch || $wgUser->getBoolOption( 'watchmoves' )
+ $watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption( 'watchmoves' )
|| $this->oldTitle->userIsWatching());
# Don't allow watching if user is not logged in
- if( $wgUser->isLoggedIn() ) {
- $wgOut->addHTML( "
+ if( $user->isLoggedIn() ) {
+ $out->addHTML( "
|
|
" .
@@ -307,7 +329,7 @@ class MovePageForm {
|
");
}
- $wgOut->addHTML( "
+ $out->addHTML( "
{$confirm}
|
@@ -316,38 +338,37 @@ class MovePageForm {
"
" .
Xml::closeElement( 'table' ) .
- Xml::hidden( 'wpEditToken', $token ) .
+ Html::hidden( 'wpEditToken', $token ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) .
"\n"
);
- $this->showLogFragment( $this->oldTitle, $wgOut );
- $this->showSubpages( $this->oldTitle, $wgOut );
+ $this->showLogFragment( $this->oldTitle );
+ $this->showSubpages( $this->oldTitle );
}
function doSubmit() {
- global $wgOut, $wgUser, $wgRequest, $wgMaximumMovedPages, $wgLang;
- global $wgFixDoubleRedirects;
+ global $wgMaximumMovedPages, $wgFixDoubleRedirects, $wgDeleteRevisionsLimit;
- if ( $wgUser->pingLimiter( 'move' ) ) {
- $wgOut->rateLimited();
- return;
+ $user = $this->getUser();
+
+ if ( $user->pingLimiter( 'move' ) ) {
+ throw new ThrottledError;
}
$ot = $this->oldTitle;
$nt = $this->newTitle;
# Delete to make way if requested
- if ( $wgUser->isAllowed( 'delete' ) && $this->deleteAndMove ) {
+ if ( $user->isAllowed( 'delete' ) && $this->deleteAndMove ) {
$article = new Article( $nt );
# Disallow deletions of big articles
$bigHistory = $article->isBigDeletion();
- if( $bigHistory && !$nt->userCan( 'bigdelete' ) ) {
- global $wgLang, $wgDeleteRevisionsLimit;
- $this->showForm( array('delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
+ if( $bigHistory && count( $nt->getUserPermissionsErrors( 'bigdelete', $user ) ) ) {
+ $this->showForm( array('delete-toobig', $this->getLang()->formatNum( $wgDeleteRevisionsLimit ) ) );
return;
}
@@ -368,17 +389,17 @@ class MovePageForm {
}
# Show a warning if the target file exists on a shared repo
- if ( $nt->getNamespace() == NS_FILE
- && !( $this->moveOverShared && $wgUser->isAllowed( 'reupload-shared' ) )
- && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
+ if ( $nt->getNamespace() == NS_FILE
+ && !( $this->moveOverShared && $user->isAllowed( 'reupload-shared' ) )
+ && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
&& wfFindFile( $nt ) )
{
$this->showForm( array('file-exists-sharedrepo') );
return;
-
+
}
-
- if ( $wgUser->isAllowed( 'suppressredirect' ) ) {
+
+ if ( $user->isAllowed( 'suppressredirect' ) ) {
$createRedirect = $this->leaveRedirect;
} else {
$createRedirect = true;
@@ -387,7 +408,7 @@ class MovePageForm {
# Do the actual move.
$error = $ot->moveTo( $nt, true, $this->reason, $createRedirect );
if ( $error !== true ) {
- # FIXME: show all the errors in a list, not just the first one
+ # @todo FIXME: Show all the errors in a list, not just the first one
$this->showForm( reset( $error ) );
return;
}
@@ -396,9 +417,10 @@ class MovePageForm {
DoubleRedirectJob::fixRedirects( 'move', $ot, $nt );
}
- wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ot , &$nt ) ) ;
+ wfRunHooks( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
- $wgOut->setPagetitle( wfMsg( 'pagemovedsub' ) );
+ $out = $this->getOutput();
+ $out->setPagetitle( wfMsg( 'pagemovedsub' ) );
$oldUrl = $ot->getFullUrl( 'redirect=no' );
$newUrl = $nt->getFullUrl();
@@ -408,8 +430,8 @@ class MovePageForm {
$newLink = "[$newUrl $newText]";
$msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
- $wgOut->addWikiMsg( 'movepage-moved', $oldLink, $newLink, $oldText, $newText );
- $wgOut->addWikiMsg( $msgName );
+ $out->addWikiMsg( 'movepage-moved', $oldLink, $newLink, $oldText, $newText );
+ $out->addWikiMsg( $msgName );
# Now we move extra pages we've been asked to move: subpages and talk
# pages. First, if the old page or the new page is a talk page, we
@@ -418,7 +440,7 @@ class MovePageForm {
$this->moveTalk = false;
}
- if( !$ot->userCan( 'move-subpages' ) ) {
+ if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) {
$this->moveSubpages = false;
}
@@ -431,10 +453,10 @@ class MovePageForm {
#
# If the target namespace doesn't allow subpages, moving with subpages
# would mean that you couldn't move them back in one operation, which
- # is bad. FIXME: A specific error message should be given in this
- # case.
-
- // FIXME: Use Title::moveSubpages() here
+ # is bad.
+ # @todo FIXME: A specific error message should be given in this case.
+
+ // @todo FIXME: Use Title::moveSubpages() here
$dbr = wfGetDB( DB_MASTER );
if( $this->moveSubpages && (
MWNamespace::hasSubpages( $nt->getNamespace() ) || (
@@ -475,7 +497,6 @@ class MovePageForm {
}
$extraOutput = array();
- $skin = $wgUser->getSkin();
$count = 1;
foreach( $extraPages as $oldSubpage ) {
if( $ot->equals( $oldSubpage ) ) {
@@ -497,7 +518,7 @@ class MovePageForm {
# be longer than 255 characters.
$newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
if( !$newSubpage ) {
- $oldLink = $skin->linkKnown( $oldSubpage );
+ $oldLink = Linker::linkKnown( $oldSubpage );
$extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
htmlspecialchars(Title::makeName( $newNs, $newPageName )));
continue;
@@ -505,7 +526,7 @@ class MovePageForm {
# This was copy-pasted from Renameuser, bleh.
if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
- $link = $skin->linkKnown( $newSubpage );
+ $link = Linker::linkKnown( $newSubpage );
$extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
} else {
$success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
@@ -513,22 +534,22 @@ class MovePageForm {
if ( $this->fixRedirects ) {
DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
}
- $oldLink = $skin->linkKnown(
+ $oldLink = Linker::linkKnown(
$oldSubpage,
null,
array(),
array( 'redirect' => 'no' )
);
- $newLink = $skin->linkKnown( $newSubpage );
+ $newLink = Linker::linkKnown( $newSubpage );
$extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
++$count;
if( $count >= $wgMaximumMovedPages ) {
- $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgMaximumMovedPages ) );
+ $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $wgMaximumMovedPages ) );
break;
}
} else {
- $oldLink = $skin->linkKnown( $oldSubpage );
- $newLink = $skin->link( $newSubpage );
+ $oldLink = Linker::linkKnown( $oldSubpage );
+ $newLink = Linker::link( $newSubpage );
$extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
}
}
@@ -536,40 +557,40 @@ class MovePageForm {
}
if( $extraOutput !== array() ) {
- $wgOut->addHTML( "\n- " . implode( "
\n- ", $extraOutput ) . "
\n
" );
+ $out->addHTML( "\n- " . implode( "
\n- ", $extraOutput ) . "
\n
" );
}
# Deal with watches (we don't watch subpages)
- if( $this->watch && $wgUser->isLoggedIn() ) {
- $wgUser->addWatch( $ot );
- $wgUser->addWatch( $nt );
+ if( $this->watch && $user->isLoggedIn() ) {
+ $user->addWatch( $ot );
+ $user->addWatch( $nt );
} else {
- $wgUser->removeWatch( $ot );
- $wgUser->removeWatch( $nt );
+ $user->removeWatch( $ot );
+ $user->removeWatch( $nt );
}
-
- # Re-clear the file redirect cache, which may have been polluted by
+
+ # Re-clear the file redirect cache, which may have been polluted by
# parsing in messages above. See CR r56745.
- # FIXME: needs a more robust solution inside FileRepo.
+ # @todo FIXME: Needs a more robust solution inside FileRepo.
if( $ot->getNamespace() == NS_FILE ) {
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot );
}
}
- function showLogFragment( $title, &$out ) {
+ function showLogFragment( $title ) {
+ $out = $this->getOutput();
$out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() );
}
- function showSubpages( $title, $out ) {
- global $wgUser, $wgLang;
-
+ function showSubpages( $title ) {
if( !MWNamespace::hasSubpages( $title->getNamespace() ) )
return;
$subpages = $title->getSubpages();
$count = $subpages instanceof TitleArray ? $subpages->count() : 0;
+ $out = $this->getOutput();
$out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
# No subpages.
@@ -578,12 +599,11 @@ class MovePageForm {
return;
}
- $out->addWikiMsg( 'movesubpagetext', $wgLang->formatNum( $count ) );
- $skin = $wgUser->getSkin();
+ $out->addWikiMsg( 'movesubpagetext', $this->getLang()->formatNum( $count ) );
$out->addHTML( "\n" );
foreach( $subpages as $subpage ) {
- $link = $skin->link( $subpage );
+ $link = Linker::link( $subpage );
$out->addHTML( "- $link
\n" );
}
$out->addHTML( "
\n" );