r105160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105159‎ | r105160 | r105161 >
Date:10:04, 5 December 2011
Author:santhosh
Status:resolved (Comments)
Tags:
Comment:
Fix Bug 32768. Add a version status to each input method, and conditionally enable the input methods
based on a global setting $wgNarayamUseBetaMapping. By default it is false.
Modified paths:
  • /trunk/extensions/Narayam/Narayam.hooks.php (modified) (history)
  • /trunk/extensions/Narayam/Narayam.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/Narayam.hooks.php
@@ -34,14 +34,25 @@
3535
3636 /// Hook: MakeGlobalVariablesScript
3737 public static function addVariables( &$vars ) {
38 - global $wgUser, $wgNarayamSchemes;
 38+ global $wgUser, $wgNarayamSchemes, $wgNarayamUseBetaMapping;
3939
4040 if ( $wgUser->getOption( 'narayamDisable' ) ) {
4141 return true;
4242 }
4343
4444 $vars['wgNarayamAvailableSchemes'] = self::getSchemes(); // Note: scheme names must be keys, not values
45 - $vars['wgNarayamAllSchemes'] = $wgNarayamSchemes;
 45+ $allSchemes = $wgNarayamSchemes;
 46+ if ( !$wgNarayamUseBetaMapping ) {
 47+ foreach ( $allSchemes as $lang => $schemes ) {
 48+ foreach ( $schemes as $i => $scheme ) {
 49+ $version = isset( $scheme[1] ) ? $scheme[1] : "stable";
 50+ if ( $version === "beta" ) {
 51+ unset( $allSchemes[$lang][$i] );
 52+ }
 53+ }
 54+ }
 55+ }
 56+ $vars['wgNarayamAllSchemes'] = $allSchemes;
4657 return true;
4758 }
4859
@@ -50,7 +61,7 @@
5162 * @return array( scheme name => module name )
5263 */
5364 protected static function getSchemes() {
54 - global $wgLanguageCode, $wgLang, $wgNarayamSchemes, $wgTitle;
 65+ global $wgLanguageCode, $wgLang, $wgNarayamSchemes, $wgTitle, $wgNarayamUseBetaMapping;
5566
5667 $userlangCode = $wgLang->getCode();
5768 $contlangSchemes = isset( $wgNarayamSchemes[$wgLanguageCode] ) ?
@@ -62,7 +73,14 @@
6374 $wgNarayamSchemes[$pagelang] : array();
6475
6576 $schemes = $userlangSchemes + $contlangSchemes + $pagelangSchemes;
66 -
 77+ if ( !$wgNarayamUseBetaMapping ) {
 78+ foreach ( $schemes as $i => $scheme ) {
 79+ $version = isset( $scheme[1] ) ? $scheme[1] : "stable";
 80+ if ( $version === "beta" ) {
 81+ unset( $schemes[$i] );
 82+ }
 83+ }
 84+ }
6785 return $schemes;
6886 }
6987
Index: trunk/extensions/Narayam/Narayam.php
@@ -44,11 +44,14 @@
4545 // Number of recently used input methods to be shown
4646 $wgNarayamRecentItemsLength = 3;
4747
 48+// Whether the extension should load input methods in beta status
 49+$wgNarayamUseBetaMapping = false;
 50+
4851 // Array mapping language codes and scheme names to module names
4952 // Custom schemes can be added here
5053 $wgNarayamSchemes = array(
5154 'am' => array(
52 - 'am' => 'ext.narayam.rules.am',
 55+ 'am' => array( 'ext.narayam.rules.am', 'beta' ),
5356 ),
5457 'as' => array(
5558 'as' => 'ext.narayam.rules.as',
@@ -62,10 +65,10 @@
6366 'bn-nkb' => 'ext.narayam.rules.bn-nkb',
6467 ),
6568 'brx' => array(
66 - 'brx-inscript' => 'ext.narayam.rules.brx-inscript',
 69+ 'brx-inscript' => array( 'ext.narayam.rules.brx-inscript', 'beta' ),
6770 ),
6871 'hne' => array(
69 - 'hne-inscript' => 'ext.narayam.rules.hne-inscript',
 72+ 'hne-inscript' => array( 'ext.narayam.rules.hne-inscript', 'beta' ),
7073 ),
7174 'de' => array(
7275 'de' => 'ext.narayam.rules.de',
@@ -74,8 +77,8 @@
7578 'eo' => 'ext.narayam.rules.eo',
7679 ),
7780 'gom-deva' => array(
78 - 'gom-deva' => 'ext.narayam.rules.gom-deva',
79 - 'gom-deva-inscript' => 'ext.narayam.rules.gom-deva-inscript',
 81+ 'gom-deva' => array( 'ext.narayam.rules.gom-deva', 'beta' ),
 82+ 'gom-deva-inscript' => array( 'ext.narayam.rules.gom-deva-inscript', 'beta' ),
8083 ),
8184 'hi' => array(
8285 'hi' => 'ext.narayam.rules.hi',
@@ -86,38 +89,38 @@
8790 'kn-inscript' => 'ext.narayam.rules.kn-inscript',
8891 ),
8992 'mai' => array(
90 - 'mai-inscript' => 'ext.narayam.rules.mai-inscript',
 93+ 'mai-inscript' => array( 'ext.narayam.rules.mai-inscript', 'beta' ),
9194 ),
9295 'ml' => array(
9396 'ml' => 'ext.narayam.rules.ml',
9497 'ml-inscript' => 'ext.narayam.rules.ml-inscript',
9598 ),
9699 'mr' => array(
97 - 'mr' => 'ext.narayam.rules.mr',
98 - 'mr-inscript' => 'ext.narayam.rules.mr',
 100+ 'mr' => array( 'ext.narayam.rules.mr', 'beta' ),
 101+ 'mr-inscript' => array( 'ext.narayam.rules.mr', 'beta' ),
99102 ),
100103 'ne' => array(
101 - 'ne' => 'ext.narayam.rules.ne',
102 - 'ne-inscript' => 'ext.narayam.rules.ne-inscript',
 104+ 'ne' => array( 'ext.narayam.rules.ne', 'beta' ),
 105+ 'ne-inscript' => array( 'ext.narayam.rules.ne-inscript', 'beta' ),
103106 ),
104107 'or' => array(
105108 'or' => 'ext.narayam.rules.or',
106 - 'or-lekhani' => 'ext.narayam.rules.or-lekhani',
 109+ 'or-lekhani' => array( 'ext.narayam.rules.or-lekhani', 'beta' ),
107110 'or-inscript' => 'ext.narayam.rules.or-inscript',
108111 ),
109112 'pa' => array(
110 - 'pa-inscript' => 'ext.narayam.rules.pa-inscript',
111 - 'pa-phonetic' => 'ext.narayam.rules.pa-phonetic',
 113+ 'pa-inscript' => array( 'ext.narayam.rules.pa-inscript', 'beta' ),
 114+ 'pa-phonetic' => array( 'ext.narayam.rules.pa-phonetic', 'beta' ),
112115 ),
113116 'rif' => array(
114 - 'ber-tfng' => 'ext.narayam.rules.ber-tfng',
 117+ 'ber-tfng' => array( 'ext.narayam.rules.ber-tfng', 'beta' ),
115118 ),
116119 'sa' => array(
117120 'sa' => 'ext.narayam.rules.sa',
118121 'sa-inscript' => 'ext.narayam.rules.sa-inscript',
119122 ),
120123 'shi' => array(
121 - 'ber-tfng' => 'ext.narayam.rules.ber-tfng',
 124+ 'ber-tfng' => array( 'ext.narayam.rules.ber-tfng', 'beta' ),
122125 ),
123126 'si' => array(
124127 'si-singlish' => 'ext.narayam.rules.si-singlish',
@@ -126,24 +129,24 @@
127130 'ta' => array(
128131 'ta' => 'ext.narayam.rules.ta',
129132 'ta-99' => 'ext.narayam.rules.ta-99',
130 - 'ta-bamini' => 'ext.narayam.rules.ta-bamini',
131 - 'ta-inscript' => 'ext.narayam.rules.ta-inscript',
 133+ 'ta-bamini' => array( 'ext.narayam.rules.ta-bamini', 'beta' ),
 134+ 'ta-inscript' => array( 'ext.narayam.rules.ta-inscript', 'beta' ),
132135 ),
133136 'te' => array(
134137 'te-inscript' => 'ext.narayam.rules.te-inscript',
135138 ),
136139 'ur' => array(
137 - 'ur' => 'ext.narayam.rules.ur',
 140+ 'ur' => array( 'ext.narayam.rules.ur', 'beta' ),
138141 ),
139142 'gu' => array(
140 - 'gu' => 'ext.narayam.rules.gu',
141 - 'gu-inscript' => 'ext.narayam.rules.gu-inscript',
 143+ 'gu' => array( 'ext.narayam.rules.gu', 'beta' ),
 144+ 'gu-inscript' => array( 'ext.narayam.rules.gu-inscript', 'beta' ),
142145 ),
143146 'ru' => array(
144 - 'ru-standard' => 'ext.narayam.rules.ru-standard',
 147+ 'ru-standard' => array( 'ext.narayam.rules.ru-standard', 'beta' ),
145148 ),
146149 'sah' => array(
147 - 'sah-standard' => 'ext.narayam.rules.sah-standard',
 150+ 'sah-standard' => array( 'ext.narayam.rules.sah-standard', 'beta' ),
148151 ),
149152 );
150153

Follow-up revisions

RevisionCommit summaryAuthorDate
r105414Follow up r105160. Make sure that resourceloader get correct module name.santhosh04:44, 7 December 2011

Comments

#Comment by SPQRobin (talk | contribs)   14:48, 5 December 2011

When we deploy these beta mappings to Wikimedia wikis, I suppose we will set $wgNarayamUseBetaMapping to true? And how do we decide which ones are beta and which not?

#Comment by Santhosh.thottingal (talk | contribs)   14:55, 5 December 2011

For wikimedia wikis, $wgNarayamUseBetaMapping will be false(default value). ie we will not enable input methods with beta status. In TWN, $wgNarayamUseBetaMapping will be true and will enable all input methods with beta status.

Input methods in development, not reviewed, not tested will be marked as beta. All new inputmethods will be beta till they are ready for deployment in Wikimedia wikis.

Also see Bug 32766 and Bug 32768

#Comment by SPQRobin (talk | contribs)   21:04, 11 December 2011

The thing is that at the India Hackathon we made those for Punjabi and Urdu, for which we submitted a bug at bugzilla:32516 and bugzilla:32515 (to enable them on their Wikipedias). So it won't be possible to actually deploy them there until they are no longer marked as beta.

Also, perhaps it would make sense to set it to true for Incubator?

#Comment by Santhosh.thottingal (talk | contribs)   03:41, 12 December 2011

Yes, We need to remove beta from them if they are stable now. Feel free to do that, if you are confident that it is ready for deployment.

Yes, for incubator, it make sense to set $wgNarayamUseBetaMapping true.

#Comment by Nikerabbit (talk | contribs)   17:29, 6 December 2011

[06-Dec-2011 17:26:25] a:2:{i:0;s:29:"ext.narayam.rules.ru-standard";i:1;s:4:"beta";} is not a string


[06-Dec-2011 17:26:25] PHP Warning: Illegal offset type in isset or empty in /www/w/includes/resourceloader/ResourceLoader.php on line 312

Status & tagging log