r97900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97899‎ | r97900 | r97901 >
Date:10:08, 23 September 2011
Author:raymond
Status:ok
Tags:
Comment:
Modernize this part: Call Linker methods statically
* wfMsg() -> wfMessage()
* no functional changes. This follows with the next commit
Modified paths:
  • /trunk/extensions/Renameuser/Renameuser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/Renameuser_body.php
@@ -285,31 +285,49 @@
286286 }
287287
288288 $output = '';
289 - $skin = $wgUser->getSkin();
290289 foreach ( $pages as $row ) {
291290 $oldPage = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
292291 $newPage = Title::makeTitleSafe( $row->page_namespace,
293292 preg_replace( '!^[^/]+!', $newusername->getDBkey(), $row->page_title ) );
294293 # Do not autodelete or anything, title must not exist
295294 if ( $newPage->exists() && !$oldPage->isValidMoveTarget( $newPage ) ) {
296 - $link = $skin->makeKnownLinkObj( $newPage );
297 - $output .= '<li class="mw-renameuser-pe">' . wfMsgHtml( 'renameuser-page-exists', $link ) . '</li>';
 295+ $link = Linker::linkKnown( $newPage );
 296+ $output .= Html::rawElement(
 297+ 'li',
 298+ array( 'class' => 'mw-renameuser-pe' ),
 299+ wfMessage( 'renameuser-page-exists' )->rawParams( $link )->escaped()
 300+ );
298301 } else {
299 - $success = $oldPage->moveTo( $newPage, false, wfMsgForContent( 'renameuser-move-log',
300 - $oldusername->getText(), $newusername->getText() ), !$suppressRedirect );
 302+ $success = $oldPage->moveTo(
 303+ $newPage,
 304+ false,
 305+ wfMessage(
 306+ 'renameuser-move-log',
 307+ $oldusername->getText(),
 308+ $newusername->getText() )->inContentLanguage()->text(),
 309+ !$suppressRedirect
 310+ );
301311 if ( $success === true ) {
302 - $oldLink = $skin->makeKnownLinkObj( $oldPage, '', 'redirect=no' );
303 - $newLink = $skin->makeKnownLinkObj( $newPage );
304 - $output .= '<li class="mw-renameuser-pm">' . wfMsgHtml( 'renameuser-page-moved', $oldLink, $newLink ) . '</li>';
 312+ $oldLink = Linker::linkKnown( $oldPage, null, array(), array( 'redirect' => 'no' ) );
 313+ $newLink = Linker::linkKnown( $newPage );
 314+ $output .= Html::rawElement(
 315+ 'li',
 316+ array( 'class' => 'mw-renameuser-pm' ),
 317+ wfMessage( 'renameuser-page-moved' )->rawParams( $oldLink, $newLink )->escaped()
 318+ );
305319 } else {
306 - $oldLink = $skin->makeKnownLinkObj( $oldPage );
307 - $newLink = $skin->makeLinkObj( $newPage );
308 - $output .= '<li class="mw-renameuser-pu">' . wfMsgHtml( 'renameuser-page-unmoved', $oldLink, $newLink ) . '</li>';
 320+ $oldLink = Linker::linkKnown( $oldPage );
 321+ $newLink = Linker::link( $newPage );
 322+ $output .= Html::rawElement(
 323+ 'li', array( 'class' => 'mw-renameuser-pu' ),
 324+ wfMessage( 'renameuser-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped()
 325+ );
309326 }
310327 }
311328 }
312 - if ( $output )
313 - $wgOut->addHTML( '<ul>' . $output . '</ul>' );
 329+ if ( $output ) {
 330+ $wgOut->addHTML( Html::rawElement( 'ul', array(), $output ) );
 331+ }
314332 }
315333
316334 // Output success message stuff :)

Status & tagging log