r56560 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56559‎ | r56560 | r56561 >
Date:19:51, 17 September 2009
Author:philip
Status:resolved
Tags:
Comment:
Follow up on r55415 and r56458. Use another way to disable variants. Server admins could disable some variants using a global variable.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -985,6 +985,16 @@
986986 /** Default variant code, if false, the default will be the language code */
987987 $wgDefaultLanguageVariant = false;
988988
 989+/** Disabled variants array of language variant conversion.
 990+ * example:
 991+ * $wgDisabledVariant[] = 'zh-mo';
 992+ * $wgDisabledVariant[] = 'zh-my';
 993+ *
 994+ * or:
 995+ * $wgDisabledVariant = array('zh-mo', 'zh-my');
 996+ */
 997+$wgDisabledVariant = array();
 998+
989999 /**
9901000 * Show a bar of language selection links in the user login and user
9911001 * registration forms; edit the "loginlanguagelinks" message to
Index: trunk/phase3/languages/LanguageConverter.php
@@ -46,7 +46,7 @@
4747 * @param array $manualLevel limit for supported variants
4848 * @public
4949 */
50 - function __construct($langobj, $maincode,
 50+ function __construct( $langobj, $maincode,
5151 $variants=array(),
5252 $variantfallbacks=array(),
5353 $markup=array(),
@@ -54,7 +54,13 @@
5555 $manualLevel = array() ) {
5656 $this->mLangObj = $langobj;
5757 $this->mMainLanguageCode = $maincode;
58 - $this->mVariants = $variants;
 58+
 59+ global $wgDisabledVariants;
 60+ $this->mVariants = array();
 61+ foreach( $variants as $variant ) {
 62+ if( !in_array( $variant, $wgDisabledVariants ) )
 63+ $this->mVariants[] = $variant;
 64+ }
5965 $this->mVariantFallbacks = $variantfallbacks;
6066 global $wgLanguageNames;
6167 $this->mVariantNames = $wgLanguageNames;
Index: trunk/phase3/RELEASE-NOTES
@@ -128,7 +128,7 @@
129129 * DISPLAYTITLE now accepts a limited amount of wiki markup (the single-quote
130130 items)
131131 * Special:Search now could search terms in all variant-forms. ONLY apply on
132 - wikis with LanguageConverter
 132+ wikis enabled LanguageConverter.
133133 * Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various
134134 user groups.
135135 * Add $wgRevokePermissions as a means of restricting a group's rights. The
@@ -228,6 +228,8 @@
229229 * Added $wgUseAJAXCategories allow enabling AJAX based categories system.
230230 This works on all namespaces. Enabled namespaces can be reduces using
231231 $wgAJAXCategoriesNamespaces.
 232+* Admins could disable some variants using $wgDisabledVariants now. ONLY apply on
 233+ wikis enabled LanguageConverter.
232234
233235 === Bug fixes in 1.16 ===
234236

Follow-up revisions

RevisionCommit summaryAuthorDate
r56561Follow up on r56560. Typo.philip19:53, 17 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r554151. Revert my revision r55371. Since it may override logged user's settings....philip16:00, 21 August 2009
r56458Partial revert of r55415, calling wfMsg in Language object constructor causes...werdna23:50, 16 September 2009

Status & tagging log