r103640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103639‎ | r103640 | r103641 >
Date:05:18, 19 November 2011
Author:robin
Status:ok (Comments)
Tags:
Comment:
Make $wgDummyLanguageCodes an associative array so it maps to the correct codes; and use it in WikimediaIncubator to check whether the wiki exists (so e.g. Wx/sgs recognizes that the wiki corresponding to Wx/bat-smg exists). The extension is compatible with the old $wgDummyLanguageCodes array.
Modified paths:
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)
  • /trunk/phase3/maintenance/language/transstat.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/transstat.php
@@ -97,7 +97,7 @@
9898 foreach ( $wgLanguages->getLanguages() as $code ) {
9999 # Don't check English, RTL English or dummy language codes
100100 if ( $code == 'en' || $code == 'enRTL' || (is_array( $wgDummyLanguageCodes ) &&
101 - in_array( $code, $wgDummyLanguageCodes ) ) ) {
 101+ isset( $wgDummyLanguageCodes[$code] ) ) ) {
102102 continue;
103103 }
104104
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -234,9 +234,8 @@
235235
236236 $languages = Language::getLanguageNames();
237237 ksort( $languages );
238 - $dummies = array_flip( $wgDummyLanguageCodes );
239238 foreach ( $languages as $code => $lang ) {
240 - if ( isset( $dummies[$code] ) ) continue;
 239+ if ( isset( $wgDummyLanguageCodes[$code] ) ) continue;
241240 $s .= "\n" . Xml::option( "$code - $lang", $code, $code == $selectedCode );
242241 }
243242 $s .= "\n</select>\n";
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1876,19 +1876,19 @@
18771877 * and excludes them when running the transstat.php script.
18781878 */
18791879 $wgDummyLanguageCodes = array(
1880 - 'als', # => 'gsw'
1881 - 'bat-smg', # => 'sgs'
1882 - 'be-x-old', # => 'be-tarask'
1883 - 'bh', # => 'bho'
1884 - 'fiu-vro', # => 'vro'
1885 - 'nb', # => 'no'
1886 - 'qqq', # Used for message documentation.
1887 - 'qqx', # Used for viewing message keys.
1888 - 'roa-rup', # => 'rup'
1889 - 'simple', # => 'en'
1890 - 'zh-classical', # => 'lzh'
1891 - 'zh-min-nan', # => 'nan'
1892 - 'zh-yue', # => 'yue'
 1880+ 'als' => 'gsw',
 1881+ 'bat-smg' => 'sgs',
 1882+ 'be-x-old' => 'be-tarask',
 1883+ 'bh' => 'bho',
 1884+ 'fiu-vro' => 'vro',
 1885+ 'nb' => 'no',
 1886+ 'qqq' => 'qqq', # Used for message documentation.
 1887+ 'qqx' => 'qqx', # Used for viewing message keys.
 1888+ 'roa-rup' => 'rup',
 1889+ 'simple' => 'en',
 1890+ 'zh-classical' => 'lzh',
 1891+ 'zh-min-nan' => 'nan',
 1892+ 'zh-yue' => 'yue',
18931893 );
18941894
18951895 /**
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -415,7 +415,11 @@
416416 } elseif( !$prefix || $prefix['error'] ) {
417417 return false; # shouldn't be, but you never know
418418 }
419 - global $wmincProjectDatabases;
 419+ global $wmincProjectDatabases, $wgDummyLanguageCodes;
 420+ $redirectcode = array_search( $prefix['lang'], $wgDummyLanguageCodes );
 421+ if( $redirectcode ) {
 422+ $prefix['lang'] = $redirectcode;
 423+ }
420424 return str_replace('-', '_', $prefix['lang'] ) .
421425 $wmincProjectDatabases[$prefix['project']];
422426 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105776MFT for WikimediaIncubator: r95582, r96122, r96138, r96141, r97175, r98670, r...siebrand00:32, 11 December 2011
r105788MFT r103640 for DefaultSettings.php. Was already merged for WikimediaIncubato...siebrand10:14, 11 December 2011
r106584Follow-up r103640robin19:20, 18 December 2011

Comments

#Comment by TheDJ (talk | contribs)   14:46, 19 November 2011

See also: Bug 32483, which details a similar problem for lang= tags in generated html.

#Comment by Siebrand (talk | contribs)   00:05, 11 December 2011

Do you want this merged into 1.18wmf1?

#Comment by SPQRobin (talk | contribs)   00:56, 11 December 2011

Yes, that would be good

Status & tagging log