r107251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107250‎ | r107251 | r107252 >
Date:00:09, 25 December 2011
Author:reedy
Status:ok
Tags:
Comment:
$wgLang can go away also
Modified paths:
  • /trunk/extensions/CentralAuth/specials/SpecialCentralAuth.php (modified) (history)
  • /trunk/extensions/CentralAuth/specials/SpecialGlobalUsers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/specials/SpecialCentralAuth.php
@@ -104,9 +104,8 @@
105105 if ( !$status->isGood() ) {
106106 $this->showStatusError( $status->getWikiText() );
107107 } else {
108 - global $wgLang;
109108 $this->showSuccess( 'centralauth-admin-unmerge-success',
110 - $wgLang->formatNum( $status->successCount ),
 109+ $this->getLanguage()->formatNum( $status->successCount ),
111110 /* deprecated */ $status->successCount );
112111 }
113112 } elseif ( $this->mMethod == 'delete' && $this->mCanUnmerge ) {
@@ -257,7 +256,6 @@
258257 * @return String
259258 */
260259 function prettyTimespan( $span ) {
261 - global $wgLang;
262260 $units = array(
263261 'seconds' => 60,
264262 'minutes' => 60,
@@ -270,24 +268,23 @@
271269 // 'centralauth-seconds-ago', 'centralauth-minutes-ago', 'centralauth-hours-ago'
272270 // 'centralauth-days-ago', 'centralauth-months-ago', 'centralauth-years-ago'
273271 if ( $span < 2 * $chunk ) {
274 - return wfMsgExt( "centralauth-$unit-ago", 'parsemag', $wgLang->formatNum( $span ) );
 272+ return wfMsgExt( "centralauth-$unit-ago", 'parsemag', $this->getLanguage()->formatNum( $span ) );
275273 }
276274 $span = intval( $span / $chunk );
277275 }
278 - return wfMsgExt( "centralauth-$unit-ago", 'parsemag', $wgLang->formatNum( $span ) );
 276+ return wfMsgExt( "centralauth-$unit-ago", 'parsemag', $this->getLanguage()->formatNum( $span ) );
279277 }
280278
281279 function showInfo() {
282280 $globalUser = $this->mGlobalUser;
283281
284 - global $wgLang;
285282 $reg = $globalUser->getRegistration();
286283 $age = $this->prettyTimespan( wfTimestamp( TS_UNIX ) - wfTimestamp( TS_UNIX, $reg ) );
287284 $attribs = array(
288285 'id' => $globalUser->getId(),
289 - 'registered' => htmlspecialchars( $wgLang->timeanddate( $reg, true ) . " ($age)" ),
 286+ 'registered' => htmlspecialchars( $this->getLanguage()->timeanddate( $reg, true ) . " ($age)" ),
290287 'home' => $this->determineHomeWiki(),
291 - 'editcount' => htmlspecialchars( $wgLang->formatNum( $this->evaluateTotalEditcount() ) ),
 288+ 'editcount' => htmlspecialchars( $this->getLanguage()->formatNum( $this->evaluateTotalEditcount() ) ),
292289 'locked' => wfMsgHtml( $globalUser->isLocked() ? 'centralauth-admin-yes' : 'centralauth-admin-no' ),
293290 'hidden' => $this->formatHiddenLevel( $globalUser->getHiddenLevel() )
294291 );
@@ -392,7 +389,6 @@
393390 * @return string
394391 */
395392 function listMergedWikiItem( $row ) {
396 - global $wgLang;
397393 if ( $row === null ) {
398394 // https://bugzilla.wikimedia.org/show_bug.cgi?id=28767
399395 // It seems sometimes local accounts aren't correctly created
@@ -406,7 +402,7 @@
407403 // invisible, to make this column sortable
408404 Html::element( 'span', array( 'style' => 'display: none' ), htmlspecialchars( $row['attachedTimestamp'] ) ) .
409405 // visible date and time in users preference
410 - htmlspecialchars( $wgLang->timeanddate( $row['attachedTimestamp'], true ) ) .
 406+ htmlspecialchars( $this->getLanguage()->timeanddate( $row['attachedTimestamp'], true ) ) .
411407 '</td>' .
412408 '<td style="text-align: center">' . $this->formatMergeMethod( $row['attachedMethod'] ) . '</td>' .
413409 '<td>' . $this->formatBlockStatus( $row ) . '</td>' .
@@ -437,10 +433,9 @@
438434 $reason = $row['block-reason'];
439435 return wfMsgExt( 'centralauth-admin-blocked-indef', 'parseinline', array( $reason ) );
440436 } else {
441 - global $wgLang;
442 - $expiry = $wgLang->timeanddate( $row['block-expiry'], true );
443 - $expiryd = $wgLang->date( $row['block-expiry'], true );
444 - $expiryt = $wgLang->time( $row['block-expiry'], true );
 437+ $expiry = $this->getLanguage()->timeanddate( $row['block-expiry'], true );
 438+ $expiryd = $this->getLanguage()->date( $row['block-expiry'], true );
 439+ $expiryt = $this->getLanguage()->time( $row['block-expiry'], true );
445440 $reason = $row['block-reason'];
446441
447442 $text = wfMsgExt( 'centralauth-admin-blocked', 'parseinline', array( $expiry, $reason, $expiryd, $expiryt ) );
@@ -468,8 +463,7 @@
469464 throw new MWException( "Invalid wiki: {$row['wiki']}" );
470465 }
471466 $wikiname = $wiki->getDisplayName();
472 - global $wgLang;
473 - $editCount = $wgLang->formatNum( intval( $row['editCount'] ) );
 467+ $editCount = $this->getLanguage()->formatNum( intval( $row['editCount'] ) );
474468 return $this->foreignLink(
475469 $row['wiki'],
476470 'Special:Contributions/' . $this->mUserName,
@@ -708,10 +702,9 @@
709703 }
710704
711705 function addMergeMethodDescriptions() {
712 - global $wgLang;
713706 $js = "wgMergeMethodDescriptions = {\n";
714707 foreach ( array( 'primary', 'new', 'empty', 'password', 'mail', 'admin', 'login' ) as $method ) {
715 - $short = Xml::encodeJsVar( $wgLang->ucfirst( wfMsgHtml( "centralauth-merge-method-{$method}" ) ) );
 708+ $short = Xml::encodeJsVar( $this->getLanguage()->ucfirst( wfMsgHtml( "centralauth-merge-method-{$method}" ) ) );
716709 $desc = Xml::encodeJsVar( wfMsgWikiHtml( "centralauth-merge-method-{$method}-desc" ) );
717710 $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' : {$desc} },\n";
718711 }
Index: trunk/extensions/CentralAuth/specials/SpecialGlobalUsers.php
@@ -109,7 +109,6 @@
110110 * @return string HTML li element with username and info about this user
111111 */
112112 function formatRow( $row ) {
113 - global $wgLang;
114113 $user = htmlspecialchars( $row->gu_name );
115114 $info = array();
116115 if ( $row->gu_locked ) {
@@ -125,7 +124,7 @@
126125 if ( $groups ) {
127126 $info[] = $groups;
128127 }
129 - $info = $wgLang->commaList( $info );
 128+ $info = $this->getLanguage()->commaList( $info );
130129 return Html::rawElement( 'li', array(), wfMsgExt( 'centralauth-listusers-item', array('parseinline'), $user, $info ) );
131130 }
132131

Status & tagging log