From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/specials/SpecialMovepage.php | 77 +++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 34 deletions(-) (limited to 'includes/specials/SpecialMovepage.php') 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 = " " . - Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) . + Xml::checkLabel( $this->msg( 'delete_and_move_confirm' )->text(), 'wpConfirm', 'wpConfirm' ) . " "; $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' ) ) . " " . - wfMsgHtml( 'movearticle' ) . + $this->msg( 'movearticle' )->escaped() . " {$oldTitleLink} @@ -261,11 +269,14 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) . + Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) . " " . 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 { " . - Xml::label( wfMsg( 'movereason' ), 'wpReason' ) . + Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) . " " . Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2, @@ -292,7 +303,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) . + Xml::checkLabel( $this->msg( 'movetalk' )->text(), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) . " " ); @@ -303,7 +314,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect', + Xml::checkLabel( $this->msg( 'move-leave-redirect' )->text(), 'wpLeaveRedirect', 'wpLeaveRedirect', $this->leaveRedirect ) . " " @@ -315,7 +326,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects', + Xml::checkLabel( $this->msg( 'fix-double-redirects' )->text(), 'wpFixRedirects', 'wpFixRedirects', $this->fixRedirects ) . " " @@ -335,15 +346,11 @@ class MovePageForm extends UnlistedSpecialPage { array( 'id' => 'wpMovesubpages' ) ) . ' ' . 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() ) . " " @@ -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( " " . - Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) . + Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) . " "); } @@ -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 ); } -- cgit v1.2.2