MediaWiki r56560 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r56559‎ | r56560 (on ViewVC)‎ | 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:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 56559)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 56560)
@@ -985,6 +985,16 @@
 /** 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: trunk/phase3/languages/LanguageConverter.php
===================================================================
--- trunk/phase3/languages/LanguageConverter.php	(revision 56559)
+++ trunk/phase3/languages/LanguageConverter.php	(revision 56560)
@@ -46,7 +46,7 @@
 	 * @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 @@
 								$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;
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 56559)
+++ trunk/phase3/RELEASE-NOTES	(revision 56560)
@@ -128,7 +128,7 @@
 * 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 @@
 * 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 ===
 

Follow-up revisions

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

Status & tagging log

Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox