Follow up on r55415 and r56458. Use another way to disable variants. Server admins...
authorPhilip Tzou <philip@users.mediawiki.org>
Thu, 17 Sep 2009 19:51:33 +0000 (19:51 +0000)
committerPhilip Tzou <philip@users.mediawiki.org>
Thu, 17 Sep 2009 19:51:33 +0000 (19:51 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
languages/LanguageConverter.php

index fb6cbb3..9dd6afd 100644 (file)
@@ -128,7 +128,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * DISPLAYTITLE now accepts a limited amount of wiki markup (the single-quote
   items)
 * Special:Search now could search terms in all variant-forms. ONLY apply on
-  wikis with LanguageConverter
+  wikis enabled LanguageConverter.
 * Add autopromote condition APCOND_BLOCKED to autopromote blocked users to various
   user groups.
 * Add $wgRevokePermissions as a means of restricting a group's rights. The
@@ -228,6 +228,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added $wgUseAJAXCategories allow enabling AJAX based categories system.
   This works on all namespaces. Enabled namespaces can be reduces using
   $wgAJAXCategoriesNamespaces.
+* Admins could disable some variants using $wgDisabledVariants now. ONLY apply on
+  wikis enabled LanguageConverter.
 
 === Bug fixes in 1.16 ===
 
index 5367619..9a40e7b 100644 (file)
@@ -985,6 +985,16 @@ $wgDisableTitleConversion = false;
 /** Default variant code, if false, the default will be the language code */
 $wgDefaultLanguageVariant = false;
 
+/** Disabled variants array of language variant conversion.
+ *  example:
+ *  $wgDisabledVariant[] = 'zh-mo';
+ *  $wgDisabledVariant[] = 'zh-my';
+ *
+ *  or:
+ *  $wgDisabledVariant = array('zh-mo', 'zh-my');
+ */
+$wgDisabledVariant = array();
+
 /**
  * Show a bar of language selection links in the user login and user
  * registration forms; edit the "loginlanguagelinks" message to
index 77e83aa..a1f6681 100644 (file)
@@ -46,7 +46,7 @@ class LanguageConverter {
         * @param array $manualLevel limit for supported variants
         * @public
         */
-       function __construct($langobj, $maincode,
+       function __construct( $langobj, $maincode,
                                                                $variants=array(),
                                                                $variantfallbacks=array(),
                                                                $markup=array(),
@@ -54,7 +54,13 @@ class LanguageConverter {
                                                                $manualLevel = array() ) {
                $this->mLangObj = $langobj;
                $this->mMainLanguageCode = $maincode;
-               $this->mVariants = $variants;
+
+               global $wgDisabledVariants;
+               $this->mVariants = array();
+               foreach( $variants as $variant ) {
+                       if( !in_array( $variant, $wgDisabledVariants ) )
+                               $this->mVariants[] = $variant;
+               }
                $this->mVariantFallbacks = $variantfallbacks;
                global $wgLanguageNames;
                $this->mVariantNames = $wgLanguageNames;