summaryrefslogtreecommitdiff
path: root/extensions/Renameuser/Renameuser_body.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-04-26 18:23:31 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-04-26 18:23:31 +0200
commitc4372dd38a4d109b4f3881ea63b667e33adbe503 (patch)
treee8e6dae1229a68c26b7a348c73dc0c8c77da97e5 /extensions/Renameuser/Renameuser_body.php
parentcf566324cfb218f0c7323d97d2a103bbb8d60ba4 (diff)
Update to MediaWiki 1.18.3
Diffstat (limited to 'extensions/Renameuser/Renameuser_body.php')
-rw-r--r--extensions/Renameuser/Renameuser_body.php69
1 files changed, 46 insertions, 23 deletions
diff --git a/extensions/Renameuser/Renameuser_body.php b/extensions/Renameuser/Renameuser_body.php
index 1e72aeaa..63ea1bbe 100644
--- a/extensions/Renameuser/Renameuser_body.php
+++ b/extensions/Renameuser/Renameuser_body.php
@@ -22,7 +22,7 @@ class SpecialRenameuser extends SpecialPage {
* @param mixed $par Parameter passed to the page
*/
public function execute( $par ) {
- global $wgOut, $wgUser, $wgRequest, $wgContLang, $wgLang;
+ global $wgOut, $wgUser, $wgRequest, $wgContLang;
global $wgCapitalLinks;
$this->setHeaders();
@@ -32,7 +32,7 @@ class SpecialRenameuser extends SpecialPage {
$wgOut->permissionRequired( 'renameuser' );
return;
}
-
+
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
@@ -101,7 +101,7 @@ class SpecialRenameuser extends SpecialPage {
"</td>
</tr>"
);
-
+
if ( $wgUser->isAllowed( 'suppressredirect' ) ) {
$wgOut->addHTML( "
<tr>
@@ -280,36 +280,58 @@ class SpecialRenameuser extends SpecialPage {
$suppressRedirect = false;
- if ( $wgRequest->getCheck( 'suppressredirect' ) && $wgUser->isAllowed( 'suppressredirect' ) ) {
+ if ( $wgRequest->getCheck( 'suppressredirect' ) && $wgUser->isAllowed( 'suppressredirect' ) ) {
$suppressRedirect = true;
}
$output = '';
- $skin = $wgUser->getSkin();
foreach ( $pages as $row ) {
$oldPage = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
$newPage = Title::makeTitleSafe( $row->page_namespace,
preg_replace( '!^[^/]+!', $newusername->getDBkey(), $row->page_title ) );
# Do not autodelete or anything, title must not exist
if ( $newPage->exists() && !$oldPage->isValidMoveTarget( $newPage ) ) {
- $link = $skin->makeKnownLinkObj( $newPage );
- $output .= '<li class="mw-renameuser-pe">' . wfMsgHtml( 'renameuser-page-exists', $link ) . '</li>';
+ $link = Linker::linkKnown( $newPage );
+ $output .= Html::rawElement(
+ 'li',
+ array( 'class' => 'mw-renameuser-pe' ),
+ wfMessage( 'renameuser-page-exists' )->rawParams( $link )->escaped()
+ );
} else {
- $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log',
- $oldusername->getText(), $newusername->getText() ), !$suppressRedirect );
+ $success = $oldPage->moveTo(
+ $newPage,
+ false,
+ wfMessage(
+ 'renameuser-move-log',
+ $oldusername->getText(),
+ $newusername->getText() )->inContentLanguage()->text(),
+ !$suppressRedirect
+ );
if ( $success === true ) {
- $oldLink = $skin->makeKnownLinkObj( $oldPage, '', 'redirect=no' );
- $newLink = $skin->makeKnownLinkObj( $newPage );
- $output .= '<li class="mw-renameuser-pm">' . wfMsgHtml( 'renameuser-page-moved', $oldLink, $newLink ) . '</li>';
+ # oldPage is not known in case of redirect suppression
+ $oldLink = Linker::link( $oldPage, null, array(), array( 'redirect' => 'no' ) );
+
+ # newPage is always known because the move was successful
+ $newLink = Linker::linkKnown( $newPage );
+
+ $output .= Html::rawElement(
+ 'li',
+ array( 'class' => 'mw-renameuser-pm' ),
+ wfMessage( 'renameuser-page-moved' )->rawParams( $oldLink, $newLink )->escaped()
+ );
} else {
- $oldLink = $skin->makeKnownLinkObj( $oldPage );
- $newLink = $skin->makeLinkObj( $newPage );
- $output .= '<li class="mw-renameuser-pu">' . wfMsgHtml( 'renameuser-page-unmoved', $oldLink, $newLink ) . '</li>';
+ $oldLink = Linker::linkKnown( $oldPage );
+ $newLink = Linker::link( $newPage );
+ $output .= Html::rawElement(
+ 'li', array( 'class' => 'mw-renameuser-pu' ),
+ wfMessage( 'renameuser-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped()
+ );
}
}
}
- if ( $output )
- $wgOut->addHTML( '<ul>' . $output . '</ul>' );
+ if ( $output ) {
+ $wgOut->addHTML( Html::rawElement( 'ul', array(), $output ) );
+ }
}
// Output success message stuff :)
@@ -320,8 +342,7 @@ class SpecialRenameuser extends SpecialPage {
/**
* @param $username Title
* @param $type
- * @param $out
- * @return void
+ * @param $out OutputPage
*/
function showLogExtract( $username, $type, &$out ) {
# Show relevant lines from the logs:
@@ -366,8 +387,9 @@ class RenameuserSQL {
/**
* Constructor
*
- * @param string $old The old username
- * @param string $new The new username
+ * @param $old string The old username
+ * @param $new string The new username
+ * @param $uid
*/
function __construct( $old, $new, $uid ) {
$this->old = $old;
@@ -420,6 +442,7 @@ class RenameuserSQL {
__METHOD__
);
if ( !$dbw->affectedRows() ) {
+ $dbw->rollback();
return false;
}
// Reset token to break login with central auth systems.
@@ -456,14 +479,14 @@ class RenameuserSQL {
__METHOD__
);
}
-
+
// Increase time limit (like CheckUser); this can take a while...
if ( $this->tablesJob ) {
wfSuppressWarnings();
set_time_limit( 120 );
wfRestoreWarnings();
}
-
+
$jobs = array(); // jobs for all tables
// Construct jobqueue updates...
// FIXME: if a bureaucrat renames a user in error, he/she