From: Philip Tzou Date: Thu, 17 Sep 2009 19:51:33 +0000 (+0000) Subject: Follow up on r55415 and r56458. Use another way to disable variants. Server admins... X-Git-Tag: 1.31.0-rc.0~39663 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=5cebac2a091ee6d1ef5454cd3d03a27f0c9f75c1;p=lhc%2Fweb%2Fwiklou.git Follow up on r55415 and r56458. Use another way to disable variants. Server admins could disable some variants using a global variable. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fb6cbb3492..9dd6afda82 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5367619d12..9a40e7b488 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 77e83aa313..a1f6681de1 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -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;