X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMovepage.php;h=393cf7ef0dc265e975d6e8d01a929267af984c5c;hb=a8f68c22a122acd6368e09c396bec4f63101a1a6;hp=ac012690f743bacf155ec46f17f0886654df577a;hpb=b3a8888f21e880fc43cc50295d256854409c4ed7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index ac012690f7..393cf7ef0d 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -27,6 +27,10 @@ * @ingroup SpecialPage */ class MovePageForm extends UnlistedSpecialPage { + + /** + * @var Title + */ var $oldTitle, $newTitle; # Objects var $reason; # Text input var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; # Checks @@ -38,99 +42,105 @@ class MovePageForm extends UnlistedSpecialPage { } public function execute( $par ) { - global $wgUser, $wgOut, $wgRequest; - - # Check for database lock - if ( wfReadOnly() ) { - $wgOut->readOnlyPage(); - return; - } + $this->checkReadOnly(); $this->setHeaders(); $this->outputHeader(); - $target = !is_null( $par ) ? $par : $wgRequest->getVal( 'target' ); + $request = $this->getRequest(); + $target = !is_null( $par ) ? $par : $request->getVal( 'target' ); // Yes, the use of getVal() and getText() is wanted, see bug 20365 - $oldTitleText = $wgRequest->getVal( 'wpOldTitle', $target ); - $newTitleText = $wgRequest->getText( 'wpNewTitle' ); + $oldTitleText = $request->getVal( 'wpOldTitle', $target ); $this->oldTitle = Title::newFromText( $oldTitleText ); - $this->newTitle = Title::newFromText( $newTitleText ); if( is_null( $this->oldTitle ) ) { - $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); - return; + throw new ErrorPageError( 'notargettitle', 'notargettext' ); } if( !$this->oldTitle->exists() ) { - $wgOut->showErrorPage( 'nopagetitle', 'nopagetext' ); - return; + throw new ErrorPageError( 'nopagetitle', 'nopagetext' ); } - # Check rights - $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $wgUser ); - if( !empty( $permErrors ) ) { - $wgOut->showPermissionsErrorPage( $permErrors ); - return; - } + $newTitleTextMain = $request->getText( 'wpNewTitleMain' ); + $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle->getNamespace() ); + // Backwards compatibility for forms submitting here from other sources + // which is more common than it should be.. + $newTitleText_bc = $request->getText( 'wpNewTitle' ); + $this->newTitle = strlen( $newTitleText_bc ) > 0 + ? Title::newFromText( $newTitleText_bc ) + : Title::makeTitleSafe( $newTitleTextNs, $newTitleTextMain ); - $def = !$wgRequest->wasPosted(); - $this->reason = $wgRequest->getText( 'wpReason' ); - $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', $def ); - $this->fixRedirects = $wgRequest->getBool( 'wpFixRedirects', $def ); - $this->leaveRedirect = $wgRequest->getBool( 'wpLeaveRedirect', $def ); - $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(); + $user = $this->getUser(); - if ( 'submit' == $wgRequest->getVal( 'action' ) && $wgRequest->wasPosted() - && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { + # Check rights + $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user ); + if ( count( $permErrors ) ) { + // Auto-block user's IP if the account was "hard" blocked + $user->spreadAnyEditBlock(); + throw new PermissionsError( 'move', $permErrors ); + } + + $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(); + + if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted() + && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); } else { - $this->showForm( '' ); + $this->showForm( array() ); } } /** * Show the form * - * @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(). + * @param $err Array: error messages. Each item is an error message. + * It 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( $this->msg( 'move-page', $this->oldTitle->getPrefixedText() ) ); + $out->addModules( 'mediawiki.special.movePage' ); $newTitle = $this->newTitle; - if( !$newTitle ) { + if ( !$newTitle ) { # Show the current title as a default # when the form is first opened. $newTitle = $this->oldTitle; - } - else { - if( empty($err) ) { - # 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]; - } + } elseif ( !count( $err ) ) { + # 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( is_array( $newerr ) ) { + $err = $newerr; } } - if ( !empty($err) && $err[0] == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) { - $wgOut->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() ); + $user = $this->getUser(); + + if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists' + && $newTitle->quickUserCan( 'delete', $user ) + ) { + $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() ); $movepagebtn = wfMsg( 'delete_and_move' ); $submitVar = 'wpDeleteAndMove'; $confirm = " @@ -140,25 +150,38 @@ class MovePageForm extends UnlistedSpecialPage { Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) . " "; - $err = ''; + $err = array(); } 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 ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo' + && $user->isAllowed( 'reupload-shared' ) + ) { + $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() ); $submitVar = 'wpMoveOverSharedFile'; - $err = ''; + $err = array(); } $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 ) { @@ -172,20 +195,36 @@ class MovePageForm extends UnlistedSpecialPage { } if ( $considerTalk ) { - $wgOut->addWikiMsg( 'movepagetalktext' ); + $out->addWikiMsg( 'movepagetalktext' ); } - $token = htmlspecialchars( $wgUser->editToken() ); + if ( count( $err ) ) { + $out->addHTML( "
\n" ); + $action_desc = $this->msg( 'action-move' )->plain(); + $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc ); - if ( !empty($err) ) { - $wgOut->setSubtitle( wfMsg( 'formerror' ) ); - if( $err[0] == 'hookaborted' ) { - $hookErr = $err[1]; - $errMsg = "

$hookErr

\n"; - $wgOut->addHTML( $errMsg ); + if ( count( $err ) == 1 ) { + $errMsg = $err[0]; + $errMsgName = array_shift( $errMsg ); + if ( $errMsgName == 'hookaborted' ) { + $out->addHTML( "

{$errMsg[0]}

\n" ); + } else { + $out->addWikiMsgArray( $errMsgName, $errMsg ); + } } else { - $wgOut->wrapWikiMsg( "

\n$1\n

", $err ); + $errStr = array(); + foreach( $err as $errMsg ) { + if( $errMsg[0] == 'hookaborted' ) { + $errStr[] = $errMsg[1]; + } else { + $errMsgName = array_shift( $errMsg ); + $errStr[] = $this->msg( $errMsgName, $errMsg )->parse(); + } + } + + $out->addHTML( '\n" ); } + $out->addHTML( "
\n" ); } if ( $this->oldTitle->isProtected( 'move' ) ) { @@ -198,19 +237,22 @@ class MovePageForm extends UnlistedSpecialPage { $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, '', array( 'lim' => 1 ) ); + $out->addHTML( "
\n" ); } - $wgOut->addHTML( + // Byte limit (not string length limit) for wpReason and wpNewTitleMain + // is enforced in the mediawiki.special.movePage module + + $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' ) . " @@ -219,11 +261,19 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::label( wfMsg( 'newtitle' ), 'wpNewTitle' ) . + Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) . " " . - Xml::input( 'wpNewTitle', 40, $wgContLang->recodeForEdit( $newTitle->getPrefixedText() ), array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) . - Xml::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . + Html::namespaceSelector( + array( 'selected' => $newTitle->getNamespace() ), + array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' ) + ) . + Xml::input( 'wpNewTitleMain', 60, $wgContLang->recodeForEdit( $newTitle->getText() ), array( + 'type' => 'text', + 'id' => 'wpNewTitleMain', + 'maxlength' => 255, + ) ) . + Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . " @@ -238,7 +288,7 @@ class MovePageForm extends UnlistedSpecialPage { ); if( $considerTalk ) { - $wgOut->addHTML( " + $out->addHTML( " " . @@ -248,8 +298,8 @@ class MovePageForm extends UnlistedSpecialPage { ); } - if ( $wgUser->isAllowed( 'suppressredirect' ) ) { - $wgOut->addHTML( " + if ( $user->isAllowed( 'suppressredirect' ) ) { + $out->addHTML( " " . @@ -261,7 +311,7 @@ class MovePageForm extends UnlistedSpecialPage { } if ( $hasRedirects ) { - $wgOut->addHTML( " + $out->addHTML( " " . @@ -272,12 +322,8 @@ class MovePageForm extends UnlistedSpecialPage { ); } - if( ($this->oldTitle->hasSubpages() || $this->oldTitle->getTalkPage()->hasSubpages()) - && $this->oldTitle->userCan( 'move-subpages' ) ) - { - global $wgMaximumMovedPages, $wgLang; - - $wgOut->addHTML( " + if( $canMoveSubpage ) { + $out->addHTML( " " . @@ -294,7 +340,7 @@ class MovePageForm extends UnlistedSpecialPage { ? 'move-subpages' : 'move-talk-subpages' ), array( 'parseinline' ), - $wgLang->formatNum( $wgMaximumMovedPages ), + $this->getLanguage()->formatNum( $wgMaximumMovedPages ), # $2 to allow use of PLURAL in message. $wgMaximumMovedPages ) @@ -304,11 +350,11 @@ class MovePageForm extends UnlistedSpecialPage { ); } - $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( " " . @@ -317,7 +363,7 @@ class MovePageForm extends UnlistedSpecialPage { "); } - $wgOut->addHTML( " + $out->addHTML( " {$confirm}   @@ -326,69 +372,74 @@ class MovePageForm extends UnlistedSpecialPage { " " . Xml::closeElement( 'table' ) . - Xml::hidden( 'wpEditToken', $token ) . + Html::hidden( 'wpEditToken', $user->getEditToken() ) . 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, $wgMaximumMovedPages, $wgLang; - global $wgFixDoubleRedirects; + global $wgMaximumMovedPages, $wgFixDoubleRedirects; - 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 ) { - $article = new Article( $nt ); - - # Disallow deletions of big articles - $bigHistory = $article->isBigDeletion(); - if( $bigHistory && !$nt->userCan( 'bigdelete' ) ) { - global $wgDeleteRevisionsLimit; - $this->showForm( array('delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) ); - return; - } - - // Delete an associated image if there is - $file = wfLocalFile( $nt ); - if( $file->exists() ) { - $file->delete( wfMsgForContent( 'delete_and_move_reason' ), false ); - } - - // This may output an error message and exit - $article->doDelete( wfMsgForContent( 'delete_and_move_reason' ) ); - } - # don't allow moving to pages with # in if ( !$nt || $nt->getFragment() != '' ) { - $this->showForm( 'badtitletext' ); + $this->showForm( array( array( 'badtitletext' ) ) ); return; } # Show a warning if the target file exists on a shared repo if ( $nt->getNamespace() == NS_FILE - && !( $this->moveOverShared && $wgUser->isAllowed( 'reupload-shared' ) ) + && !( $this->moveOverShared && $user->isAllowed( 'reupload-shared' ) ) && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt ) && wfFindFile( $nt ) ) { - $this->showForm( array('file-exists-sharedrepo') ); + $this->showForm( array( array( 'file-exists-sharedrepo' ) ) ); return; } - if ( $wgUser->isAllowed( 'suppressredirect' ) ) { + # Delete to make way if requested + if ( $this->deleteAndMove ) { + $permErrors = $nt->getUserPermissionsErrors( 'delete', $user ); + if ( count( $permErrors ) ) { + # Only show the first error + $this->showForm( $permErrors ); + return; + } + + $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text(); + + // Delete an associated image if there is + if ( $nt->getNamespace() == NS_FILE ) { + $file = wfLocalFile( $nt ); + if ( $file->exists() ) { + $file->delete( $reason, false ); + } + } + + $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() ) ) ) ); + return; + } + } + + if ( $user->isAllowed( 'suppressredirect' ) ) { $createRedirect = $this->leaveRedirect; } else { $createRedirect = true; @@ -397,8 +448,7 @@ class MovePageForm extends UnlistedSpecialPage { # 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 - $this->showForm( reset( $error ) ); + $this->showForm( $error ); return; } @@ -406,20 +456,25 @@ class MovePageForm extends UnlistedSpecialPage { 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( $this->msg( 'pagemovedsub' ) ); - $oldUrl = $ot->getFullUrl( 'redirect=no' ); - $newUrl = $nt->getFullUrl(); + $oldLink = Linker::link( + $ot, + null, + array(), + array( 'redirect' => 'no' ) + ); + $newLink = Linker::linkKnown( $nt ); $oldText = $ot->getPrefixedText(); $newText = $nt->getPrefixedText(); - $oldLink = "[$oldUrl $oldText]"; - $newLink = "[$newUrl $newText]"; $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect'; - $wgOut->addWikiMsg( 'movepage-moved', $oldLink, $newLink, $oldText, $newText ); - $wgOut->addWikiMsg( $msgName ); + $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink, + $newLink )->params( $oldText, $newText )->parseAsBlock() ); + $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 @@ -428,7 +483,7 @@ class MovePageForm extends UnlistedSpecialPage { $this->moveTalk = false; } - if( !$ot->userCan( 'move-subpages' ) ) { + if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) { $this->moveSubpages = false; } @@ -441,10 +496,10 @@ class MovePageForm extends UnlistedSpecialPage { # # 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. + # is bad. + # @todo FIXME: A specific error message should be given in this case. - // FIXME: Use Title::moveSubpages() here + // @todo FIXME: Use Title::moveSubpages() here $dbr = wfGetDB( DB_MASTER ); if( $this->moveSubpages && ( MWNamespace::hasSubpages( $nt->getNamespace() ) || ( @@ -485,7 +540,6 @@ class MovePageForm extends UnlistedSpecialPage { } $extraOutput = array(); - $skin = $wgUser->getSkin(); $count = 1; foreach( $extraPages as $oldSubpage ) { if( $ot->equals( $oldSubpage ) ) { @@ -507,7 +561,7 @@ class MovePageForm extends UnlistedSpecialPage { # 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; @@ -515,7 +569,7 @@ class MovePageForm extends UnlistedSpecialPage { # 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 ); @@ -523,22 +577,22 @@ class MovePageForm extends UnlistedSpecialPage { if ( $this->fixRedirects ) { DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage ); } - $oldLink = $skin->linkKnown( + $oldLink = Linker::link( $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->getLanguage()->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 ); } } @@ -546,40 +600,40 @@ class MovePageForm extends UnlistedSpecialPage { } if( $extraOutput !== array() ) { - $wgOut->addHTML( "" ); + $out->addHTML( "" ); } # 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 # 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() ); + LogEventsList::showLogExtract( $out, 'move', $title ); } - 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. @@ -588,15 +642,13 @@ class MovePageForm extends UnlistedSpecialPage { return; } - $out->addWikiMsg( 'movesubpagetext', $wgLang->formatNum( $count ) ); - $skin = $wgUser->getSkin(); + $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) ); $out->addHTML( "\n" ); } } -