r86245 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86244‎ | r86245 | r86246 >
Date:22:52, 16 April 2011
Author:bawolff
Status:ok
Tags:
Comment:
(patch by Yuvipanda) Change all uses of $wgLanguageNames to Language::getLanguageNames()
in order to be compatible post r85327.

$wgLanguageNames was marked as private since forever.

Note, the OtherSites extension is already fairly broken from my understanding
and its unclear if what its doing ever actually worked...
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)
  • /trunk/extensions/GetFamily/GetFamily.php (modified) (history)
  • /trunk/extensions/LanguageSelector/LanguageSelector.php (modified) (history)
  • /trunk/extensions/OtherSites/OtherSites.php (modified) (history)
  • /trunk/extensions/Polyglot/Polyglot.php (modified) (history)
  • /trunk/extensions/SiteMatrix/SiteMatrixApi.php (modified) (history)
  • /trunk/extensions/SiteMatrix/SiteMatrix_body.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Polyglot/Polyglot.php
@@ -35,7 +35,7 @@
3636 * and to lookups for loclaized pages.
3737 * Set this to a small set of languages that are likely to be used on your site to
3838 * improve performance. Leave NULL to allow all languages known to MediaWiki via
39 -* $wgLanguageNames.
 39+* languages/Names.php.
4040 * If the LanguageSelector extension is installed, $wgLanguageSelectorLanguages is used
4141 * as a fallback.
4242 */
@@ -77,7 +77,7 @@
7878 }
7979
8080 if ( $wgPolyglotLanguages === null ) {
81 - $wgPolyglotLanguages = array_keys( $GLOBALS['wgLanguageNames'] );
 81+ $wgPolyglotLanguages = array_keys( Language::getLanguageNames() );
8282 }
8383 }
8484
Index: trunk/extensions/LanguageSelector/LanguageSelector.php
@@ -44,7 +44,7 @@
4545
4646 /**
4747 * Languages to offer in the language selector. Per default, this includes all languages MediaWiki knows
48 -* about by virtue of $wgLanguageNames. A shorter list may be more usable, though.
 48+* about by virtue of languages/Names.php. A shorter list may be more usable, though.
4949 */
5050 $wgLanguageSelectorLanguages = null;
5151
Index: trunk/extensions/SiteMatrix/SiteMatrixApi.php
@@ -16,9 +16,9 @@
1717 }
1818
1919 public function execute() {
20 - global $wgLanguageNames;
2120 $result = $this->getResult();
2221 $matrix = new SiteMatrix();
 22+ $langNames = Language::getLanguageNames();
2323
2424 $matrix_out = array(
2525 'count' => $matrix->getCount(),
@@ -35,7 +35,7 @@
3636 $langhost = str_replace( '_', '-', $lang );
3737 $language = array(
3838 'code' => $langhost,
39 - 'name' => $wgLanguageNames[$lang],
 39+ 'name' => $langNames[$lang],
4040 'site' => array(),
4141 );
4242 if( isset( $localLanguageNames[$lang] ) ) {
Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php
@@ -282,7 +282,8 @@
283283 }
284284
285285 function execute( $par ) {
286 - global $wgOut, $wgRequest, $wgLanguageNames;
 286+ global $wgOut, $wgRequest;
 287+ $langNames = Language::getLanguageNames();
287288
288289 $this->setHeaders();
289290 $this->outputHeader();
@@ -307,7 +308,7 @@
308309 $langhost = str_replace( '_', '-', $lang );
309310 $attribs = array(
310311 'code' => $langhost,
311 - 'name' => $wgLanguageNames[$lang],
 312+ 'name' => $langNames[$lang],
312313 );
313314 if( isset( $localLanguageNames[$lang] ) ) {
314315 $attribs['localname'] = $localLanguageNames[$lang];
@@ -360,7 +361,7 @@
361362 $attribs['title'] = $localLanguageNames[$lang];
362363 }
363364
364 - $langDisplay = $wgLanguageNames[$lang];
 365+ $langDisplay = $langNames[$lang];
365366 if ( strlen( $localLanguageNames[$lang] ) && $langDisplay != $localLanguageNames[$lang] ) {
366367 $langDisplay .= ' (' . $localLanguageNames[$lang] . ')';
367368 }
@@ -426,4 +427,4 @@
427428 $wgOut->addHTML( $s );
428429 $wgOut->addWikiMsg( 'sitematrix-total', $matrix->getCount() );
429430 }
430 -}
\ No newline at end of file
 431+}
Index: trunk/extensions/OtherSites/OtherSites.php
@@ -50,6 +50,7 @@
5151 require_once('languages/Names.php');
5252
5353 foreach ( array_keys( $wgOtherSites ) as $key ) {
 54+ /* FIXME: VERY VERY BROKEN */
5455 $wgLanguageNames[$key] = $wgOtherSites[$key];
5556 }
5657 }
Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -1092,7 +1092,7 @@
10931093 * Suppresses a local account of a user.
10941094 */
10951095 public function doLocalSuppression( $suppress, $wiki, $by, $reason ) {
1096 - global $wgConf, $wgLanguageNames;
 1096+ global $wgConf;
10971097
10981098 $lb = wfGetLB( $wiki );
10991099 $dbw = $lb->getConnection( DB_MASTER, array(), $wiki );
@@ -1100,7 +1100,8 @@
11011101
11021102 if ( $suppress ) {
11031103 list( $site, $lang ) = $wgConf->siteFromDB( $wiki );
1104 - $lang = isset( $wgLanguageNames[$lang] ) ? $lang : 'en';
 1104+ $langNames = Language::getLanguageNames();
 1105+ $lang = isset( $langNames[$lang] ) ? $lang : 'en';
11051106 $blockReason = wfMsgReal( 'centralauth-admin-suppressreason',
11061107 array( $by, $reason ), true, $lang );
11071108
Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
@@ -81,8 +81,9 @@
8282 * @param $target Mixed: user whose language and test wiki we're looking up
8383 */
8484 function showInfo( $target ) {
85 - global $wgOut, $wgLang, $wgLanguageNames, $wmincPref;
 85+ global $wgOut, $wgLang, $wmincPref;
8686 $user = User::newFromName( $target );
 87+ $langNames = Language::getLanguageNames();
8788 if ( $user == null || $user->getId() == 0 ) {
8889 $wgOut->addWikiText( '<span class="error">' . wfMsgNoTrans( 'wminc-viewuserlang-unexisting', $target ) . '</span>' );
8990 } else {
@@ -94,7 +95,7 @@
9596 ) ) );
9697 $wgOut->addWikiText(
9798 '*' . wfMsg( 'loginlanguagelabel',
98 - $wgLanguageNames[$user->mOptions['language']] . ' (' . $user->mOptions['language'] . ')'
 99+ $langNames[$user->mOptions['language']] . ' (' . $user->mOptions['language'] . ')'
99100 )
100101 );
101102 if ( IncubatorTest::isNormalPrefix() == true ) {
Index: trunk/extensions/GetFamily/GetFamily.php
@@ -44,7 +44,7 @@
4545 }
4646
4747 function execute() {
48 - global $wgRequest, $wgLanguageNames, $wgUser, $wgOut;
 48+ global $wgRequest, $wgUser, $wgOut;
4949 global $wgScript, $wgDBname, $wgLanguageCode, $wgSitename, $wgServer, $wgArticlePath, $wgVersion;
5050
5151 if( !$wgUser->isAllowed( 'getfamily' ) ){
@@ -87,7 +87,8 @@
8888 } else {
8989 header( 'Content-Type: text/plain' );
9090
91 - $langcodes = array_keys( $wgLanguageNames );
 91+ $langNames = Language::getLanguageNames();
 92+ $langcodes = array_keys( $langNames );
9293
9394 $dbr = wfGetDB( DB_SLAVE );
9495 foreach ( $langcodes as $lang_code ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85327The beginnings of HipHop compiled mode support. It works now for parser cache...tstarling12:59, 4 April 2011

Status & tagging log