r88490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88489‎ | r88490 | r88491 >
Date:21:34, 20 May 2011
Author:robin
Status:ok
Tags:
Comment:
* Code improvements after review by Roan Kattouw
* Introduce validateLanguageCode() and validatePrefix()
Modified paths:
  • /trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/TestWikiRC.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/WikimediaIncubator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
@@ -11,7 +11,7 @@
1212 'path' => __FILE__,
1313 'name' => 'Wikimedia Incubator',
1414 'author' => 'SPQRobin',
15 - 'version' => '2.4',
 15+ 'version' => '3.0',
1616 'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
1717 'descriptionmsg' => 'wminc-desc',
1818 );
@@ -20,7 +20,7 @@
2121 $wgGroupPermissions['*']['viewuserlang'] = false;
2222 $wgGroupPermissions['sysop']['viewuserlang'] = true;
2323
24 -/* General (kind of globals) */
 24+/* General (globals and/or configuration) */
2525 $wmincPref = 'incubatortestwiki'; // Name of the preference
2626 $dir = dirname( __FILE__ ) . '/';
2727 $wmincProjects = array(
@@ -34,6 +34,12 @@
3535 'name' => 'Incubator',
3636 'short' => 'inc',
3737 );
 38+$wmincTestWikiNamespaces = array(
 39+ NS_MAIN, NS_TALK,
 40+ NS_TEMPLATE, NS_TEMPLATE_TALK,
 41+ NS_CATEGORY, NS_CATEGORY_TALK,
 42+);
 43+$wmincLangCodeLength = 3; // can be increased if needed (depends on policy)
3844
3945 $wgExtensionMessagesFiles['WikimediaIncubator'] = $dir . 'WikimediaIncubator.i18n.php';
4046
@@ -42,7 +48,7 @@
4349 $wgSpecialPages['ViewUserLang'] = 'SpecialViewUserLang';
4450 $wgSpecialPageGroups['ViewUserLang'] = 'users';
4551 $wgAvailableRights[] = 'viewuserlang';
46 -$wgHooks['ContributionsToolLinks'][] = 'efLoadViewUserLangLink';
 52+$wgHooks['ContributionsToolLinks'][] = 'IncubatorTest::efLoadViewUserLangLink';
4753
4854 /* TestWiki preference */
4955 $wgAutoloadClasses['IncubatorTest'] = $dir . 'IncubatorTest.php';
@@ -52,7 +58,7 @@
5359 $wgHooks['ParserGetVariableValueSwitch'][] = 'IncubatorTest::magicWordValue';
5460
5561 /* Edit page */
56 -$wgHooks['EditPage::showEditForm:initial'][] = 'IncubatorTest::editPageCheckPrefix';
 62+$wgHooks['EditPage::showEditForm:initial'][] = 'IncubatorTest::checkPrefixOnEditPage';
5763
5864 /* Recent Changes */
5965 $wgAutoloadClasses['TestWikiRC'] = $dir . 'TestWikiRC.php';
Index: trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php
@@ -8,7 +8,7 @@
99 {
1010 public function __construct() {
1111 global $wgUser, $wmincPref, $wmincProjectSite;
12 - if(IncubatorTest::isNormalPrefix()) {
 12+ if( IncubatorTest::isContentProject() ) {
1313 $dbr = wfGetDB( DB_SLAVE );
1414 $this->extra[] = 'page_title' .
1515 $dbr->buildLike( IncubatorTest::displayPrefix() . '/', $dbr->anyString() );
Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
@@ -32,11 +32,7 @@
3333 return;
3434 }
3535
36 - if ( $subpage ) {
37 - $target = $subpage;
38 - } else {
39 - $target = $wgRequest->getText( 'target' );
40 - }
 36+ $target = $wgRequest->getText( 'target', $subpage );
4137
4238 $this->showForm( $target );
4339
@@ -53,13 +49,13 @@
5450 global $wgScript, $wgOut;
5551
5652 $wgOut->addHTML(
57 - Xml::fieldset( wfMsg( 'wminc-viewuserlang' ) ) .
 53+ Xml::fieldset( wfMsgHtml( 'wminc-viewuserlang' ) ) .
5854 Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
5955 Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
6056 "<p>" .
61 - Xml::inputLabel( wfMsg( 'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
 57+ Xml::inputLabel( wfMsgHtml( 'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
6258 ' ' .
63 - Xml::submitButton( wfMsg( 'wminc-viewuserlang-go' ) ) .
 59+ Xml::submitButton( wfMsgHtml( 'wminc-viewuserlang-go' ) ) .
6460 "</p>" .
6561 Xml::closeElement( 'form' ) .
6662 Xml::closeElement( 'fieldset' )
@@ -79,22 +75,21 @@
8076 // show error if a user with that name does not exist
8177 $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) );
8278 } else {
83 - if ( IncubatorTest::isNormalPrefix() == true ) {
84 - $testwiki = Linker::link( 'W' . $user->getOption($wmincPref . '-project') .
85 - '/' . $user->getOption($wmincPref . '-code') );
 79+ if ( IncubatorTest::isContentProject() ) {
 80+ $testwiki = $sk->link( Title::newFromText( IncubatorTest::displayPrefix() ) );
8681 } elseif ( IncubatorTest::displayPrefix() == $wmincProjectSite['short'] ) {
87 - $testwiki = $wmincProjectSite['name'];
 82+ $testwiki = htmlspecialchars( $wmincProjectSite['name'] );
8883 } else {
89 - $testwiki = wfMsg( 'wminc-testwiki-none' );
 84+ $testwiki = wfMsgHtml( 'wminc-testwiki-none' );
9085 }
9186 $name = $user->getName();
9287 $wgOut->addHtml(
9388 Xml::openElement( 'ul' ) .
94 - '<li>' . wfMsg( 'username' ) . ' ' .
 89+ '<li>' . wfMsgHtml( 'username' ) . ' ' .
9590 $sk->userLink( $name, $name ) . $sk->userToolLinks( $name, $name ) . '</li>' .
96 - '<li>' . wfMsg( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] .
 91+ '<li>' . wfMsgHtml( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] .
9792 ' (' . $user->getOption( 'language' ) . ')' ) . '</li>' .
98 - '<li>' . wfMsg( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' .
 93+ '<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' .
9994 Xml::closeElement( 'ul' )
10095 );
10196 }
Index: trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
@@ -7,11 +7,11 @@
88 * change their preferences (automatically is always better :p)
99 */
1010 class AutoTestWiki {
11 - function onUserCreateForm( $template ) {
 11+ public static function onUserCreateForm( $template ) {
1212 global $wgRequest, $wmincProjects;
1313 $projectvalue = strtolower( $wgRequest->getVal( 'testwikiproject', '' ) );
1414 $codevalue = strtolower( $wgRequest->getVal( 'testwikicode', '' ) );
15 - if ( preg_match( '/[a-z][a-z][a-z]?/', $codevalue ) && in_array( $projectvalue, (array)$wmincProjects ) ) {
 15+ if ( IncubatorTest::validateLanguageCode( $codevalue ) && in_array( $projectvalue, (array)$wmincProjects ) ) {
1616 $template->set( 'header',
1717 Html::hidden('testwiki-project', $projectvalue).
1818 Html::hidden('testwiki-code', $codevalue)
@@ -20,13 +20,13 @@
2121 return true;
2222 }
2323
24 - function onAddNewAccount( $user ) {
25 - global $wgRequest, $wmincPref;
26 - $getprojectvalue = $wgRequest->getVal( 'testwiki-project' );
27 - $getcodevalue = $wgRequest->getVal( 'testwiki-code' );
28 - if ( $getprojectvalue && $getcodevalue ) {
29 - $user->setOption( $wmincPref . '-project', $getprojectvalue );
30 - $user->setOption( $wmincPref . '-code', $getcodevalue );
 24+ public static function onAddNewAccount( $user ) {
 25+ global $wgRequest, $wmincProjects, $wmincPref;
 26+ $projectvalue = $wgRequest->getVal( 'testwiki-project' );
 27+ $codevalue = $wgRequest->getVal( 'testwiki-code' );
 28+ if ( IncubatorTest::validateLanguageCode( $codevalue ) && in_array( $projectvalue, (array)$wmincProjects ) ) {
 29+ $user->setOption( $wmincPref . '-project', $projectvalue );
 30+ $user->setOption( $wmincPref . '-code', $codevalue );
3131 $user->saveSettings();
3232 }
3333 return true;
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -6,7 +6,8 @@
77 class IncubatorTest
88 {
99 static function onGetPreferences( $user, &$preferences ) {
10 - global $wmincPref, $wmincProjects, $wmincProjectSite, $wmincPrefProject, $wmincPrefNone, $wgDefaultUserOptions;
 10+ global $wmincPref, $wmincProjects, $wmincProjectSite,
 11+ $wmincLangCodeLength, $wgDefaultUserOptions;
1112
1213 $preferences['language']['help-message'] = 'wminc-prefinfo-language';
1314
@@ -24,10 +25,10 @@
2526 'section' => 'personal/i18n',
2627 'label-message' => 'wminc-testwiki',
2728 'id' => $wmincPref . '-code',
28 - 'maxlength' => 3,
29 - 'size' => 3,
 29+ 'maxlength' => (int)$wmincLangCodeLength,
 30+ 'size' => (int)$wmincLangCodeLength,
3031 'help-message' => 'wminc-prefinfo-code',
31 - 'validation-callback' => array( 'IncubatorTest', 'CodeValidation' ),
 32+ 'validation-callback' => array( 'IncubatorTest', 'validateCodePreference' ),
3233 );
3334
3435 $wgDefaultUserOptions[$wmincPref . '-project'] = 'none';
@@ -37,7 +38,7 @@
3839 return true;
3940 }
4041
41 - function codeValidation( $input, $alldata ) {
 42+ static function validateCodePreference( $input, $alldata ) {
4243 global $wmincPref, $wmincProjects;
4344 // If the user selected a project that NEEDS a language code, but the user DID NOT enter a language code, give an error
4445 if ( isset( $alldata[$wmincPref.'-project'] ) && in_array( $alldata[$wmincPref.'-project'], $wmincProjects ) && !$input ) {
@@ -47,48 +48,89 @@
4849 }
4950 }
5051
51 - function isNormalPrefix() {
 52+ /*
 53+ * This validates a language code. Currently it is set
 54+ * to only allow two or three-letter codes strictly, but
 55+ * it can be changed when the policy changes.
 56+ * See also $wmincLangCodeLength.
 57+ */
 58+ static function validateLanguageCode( $code ) {
 59+ return (bool) preg_match( '/[a-z][a-z][a-z]?/', $code );
 60+ }
 61+
 62+ /*
 63+ * Same as above, but for full prefix in a given title.
 64+ * @param $onlyprefix Bool Whether to validate only the prefix, or
 65+ * also allow other text within the page title (Wx/xxx vs Wx/xxx/Text)
 66+ */
 67+ static function validatePrefix( $title, $onlyprefix = false ) {
 68+ global $wmincProjects;
 69+ $listProjects = implode( '', $wmincProjects ); // something like: pbtqn
 70+ return (bool) preg_match( '/^W['.$listProjects.']\/[a-z][a-z][a-z]?' .
 71+ ($onlyprefix ? '' : '' ) . '/', $title );
 72+ }
 73+
 74+ /*
 75+ * Returns true if the given project (or preference
 76+ * by default) is one of the projects using the
 77+ * format Wx/xxx (as defined in $wmincProjects)
 78+ */
 79+ static function isContentProject( $project = '' ) {
5280 global $wgUser, $wmincPref, $wmincProjects;
53 - if ( in_array( $wgUser->getOption($wmincPref . '-project'), $wmincProjects ) ) {
54 - return true; // true because this is a normal prefix
55 - } else {
56 - return false; // false because this is NOT a normal prefix
57 - }
 81+ $project = ($project ? $project : $wgUser->getOption($wmincPref . '-project') );
 82+ return (bool) in_array( $project, $wmincProjects );
5883 }
5984
60 - function displayPrefix() {
61 - // display the prefix of the user preference
 85+ /*
 86+ * display the prefix by the given project and code
 87+ * (or the user preference if no parameters are given)
 88+ */
 89+ static function displayPrefix( $project = '', $code = '' ) {
6290 global $wgUser, $wmincPref;
63 - if ( self::isNormalPrefix() == true ) {
64 - return 'W' . $wgUser->getOption($wmincPref . '-project') . '/' . $wgUser->getOption($wmincPref . '-code'); // return the prefix
 91+ if ( self::isContentProject() ) {
 92+ // return the prefix
 93+ return 'W' . ( $project ? $project : $wgUser->getOption($wmincPref . '-project') ) .
 94+ '/' . ( $code ? $code : $wgUser->getOption($wmincPref . '-code') ); // return the prefix
6595 } else {
66 - return $wgUser->getOption($wmincPref . '-project'); // still provide the value
 96+ // still provide the value
 97+ return $wgUser->getOption($wmincPref . '-project');
6798 }
6899 }
69100
70 - function displayPrefixedTitle( $title, $namespace = '' ) {
71 - global $wgUser, $wmincPref;
72 - $out = '';
73 - if ( self::isNormalPrefix() ) {
74 - if ( $namespace ) { $out .= $namespace . ':'; }
75 - $out .= self::displayPrefix() . '/' . $title;
 101+ /*
 102+ * Makes a full prefixed title of a given page title and namespace
 103+ * @param $ns Tnt numeric value of namespace
 104+ */
 105+ static function displayPrefixedTitle( $title, $ns = 0 ) {
 106+ global $wgLang, $wmincTestWikiNamespaces;
 107+ if( in_array( $ns, $wmincTestWikiNamespaces ) ) {
 108+ /* Standard namespace as defined by
 109+ * $wmincTestWikiNamespaces, so use format:
 110+ * TITLE + NS => NS:Wx/xxx/TITLE
 111+ */
 112+ $title = Title::makeTitleSafe( $ns, self::displayPrefix() . '/' . $title );
76113 } else {
77 - $out .= self::displayPrefix();
 114+ /* Non-standard namespace, so use format:
 115+ * TITLE + NS => Wx/xxx/NS:TITLE
 116+ * (with localized namespace name)
 117+ */
 118+ $title = Title::makeTitleSafe( NULL, self::displayPrefix() . '/' .
 119+ $wgLang->getNsText( $ns ) . ':' . $title );
78120 }
79 - return $out;
 121+ return $title;
80122 }
81123
82 - function magicWordVariable( &$magicWords ) {
 124+ static function magicWordVariable( &$magicWords ) {
83125 $magicWords[] = 'usertestwiki';
84126 return true;
85127 }
86128
87 - function magicWord( &$magicWords, $langCode ) {
 129+ static function magicWord( &$magicWords, $langCode ) {
88130 $magicWords['usertestwiki'] = array( 0, 'USERTESTWIKI' );
89131 return true;
90132 }
91133
92 - function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret ) {
 134+ static function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret ) {
93135 if( !self::displayPrefix() ) {
94136 $ret = 'none';
95137 } else {
@@ -97,55 +139,57 @@
98140 return true;
99141 }
100142
101 - function editPageCheckPrefix( $editpage ) {
 143+ static function checkPrefixOnEditPage( $editpage ) {
 144+ global $wmincProjectSite;
102145 // If user has "project" as test wiki preference, it isn't needed to check
103 - if ( self::displayPrefix() == 'inc' ) {
 146+ if ( self::displayPrefix() == $wmincProjectSite['short'] ) {
104147 return true;
105148 }
106 - global $wgTitle;
107 - $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
108 - // If it is in one of the above namespace, check if the page title has a prefix
109 - if ( in_array( $wgTitle->getNamespace(), $namespaces ) && !preg_match( '/W[bnpqt]\/[a-z][a-z][a-z]?/', $wgTitle->getText() ) ) {
110 - global $wgOut;
111 -
112 - $warning = '<div id="wminc-warning"><span id="wm-warning-unprefixed">'
113 - . wfMsg( 'wminc-warning-unprefixed' )
 149+ global $wgTitle, $wmincTestWikiNamespaces;
 150+ $title = $wgTitle->getText();
 151+ $ns = $wgTitle->getNamespace();
 152+ // If it's in one of the content namespaces or if the page title has a prefix, return
 153+ if ( !in_array( $ns, $wmincTestWikiNamespaces ) || self::validatePrefix( $title ) ) {
 154+ return true;
 155+ }
 156+ $warning = '<div id="wminc-warning"><span id="wm-warning-unprefixed">'
 157+ . wfMsg( 'wminc-warning-unprefixed' )
 158+ . '</span>';
 159+ // If the user has a test wiki pref, suggest a page title with prefix
 160+ if ( self::isContentProject() ) {
 161+ global $wgUser;
 162+ $suggest = self::displayPrefixedTitle( $title, $ns );
 163+ if ( !$wgTitle->exists() ) { // Creating a page, so suggest to create a prefixed page
 164+ $warning .= ' <span id="wminc-warning-suggest">'
 165+ . wfMsg( 'wminc-warning-suggest', $suggest )
114166 . '</span>';
115 - // If the user has a test wiki pref, suggest a page title with prefix
116 - if ( self::isNormalPrefix() ) {
117 - global $wgUser;
118 - $suggest = self::displayPrefixedTitle( $wgTitle->getText(), $wgTitle->getNsText() );
119 - if ( !$wgTitle->exists() ) { // Creating a page, so suggest to create a prefixed page
120 - $warning .= ' <span id="wminc-warning-suggest">'
121 - . wfMsg( 'wminc-warning-suggest', $suggest )
122 - . '</span>';
123 - } elseif ( $wgUser->isAllowed( 'move' ) ) { // Page exists, so suggest to move
124 - $warning .= ' <span id="wminc-warning-suggest-move" class="plainlinks">'
125 - . wfMsg( 'wminc-warning-suggest-move', $suggest, urlencode( $suggest ), urlencode( $wgTitle ) )
126 - . '</span>';
127 - }
128 - }
129 - $warning .= '</div>';
130 - $wgOut->addWikiText( $warning );
 167+ } elseif ( $wgUser->isAllowed( 'move' ) ) { // Page exists, so suggest to move
 168+ $warning .= ' <span id="wminc-warning-suggest-move" class="plainlinks">'
 169+ . wfMsg( 'wminc-warning-suggest-move', $suggest, wfUrlencode( $suggest ), wfUrlencode( $wgTitle ) )
 170+ . '</span>';
 171+ }
131172 }
 173+ $warning .= '</div>';
 174+ global $wgOut;
 175+ $wgOut->addWikiText( $warning );
132176 return true;
133177 }
134 -}
135178
136 -/**
137 - * Add a link to Special:ViewUserLang from Special:Contributions/USERNAME
138 - * if the user has 'viewuserlang' permission
139 - * Based on code from extension LookupUser made by Tim Starling
140 - * @return true
141 - */
142 -function efLoadViewUserLangLink( $id, $nt, &$links ) {
143 - global $wgUser;
144 - if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
145 -
146 - $links[] = $wgUser->getSkin()->makeKnownLinkObj(
147 - SpecialPage::getTitleFor( 'ViewUserLang' ),
148 - wfMsgHtml( 'wminc-viewuserlang' ),
149 - '&target=' . urlencode( $nt->getText() ) );
 179+ /**
 180+ * Add a link to Special:ViewUserLang from Special:Contributions/USERNAME
 181+ * if the user has 'viewuserlang' permission
 182+ * Based on code from extension LookupUser made by Tim Starling
 183+ * @return true
 184+ */
 185+ static function efLoadViewUserLangLink( $id, $nt, &$links ) {
 186+ global $wgUser;
 187+ if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
 188+ $user = wfUrlencode( $nt->getText() );
 189+ $links[] = $wgUser->getSkin()->link(
 190+ SpecialPage::getTitleFor( 'ViewUserLang', $user ),
 191+ wfMsgHtml( 'wminc-viewuserlang' )
 192+ );
 193+ }
 194+ return true;
150195 }
151 - return true;
152 -}
 196+}
\ No newline at end of file
Index: trunk/extensions/WikimediaIncubator/TestWikiRC.php
@@ -5,15 +5,15 @@
66
77 class TestWikiRC {
88 static function onRcQuery( &$conds, &$tables, &$join_conds, $opts ) {
9 - global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite;
 9+ global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite, $wmincTestWikiNamespaces;
1010 $projectvalue = strtolower( $wgRequest->getVal( 'rc-testwiki-project', $wgUser->getOption($wmincPref . '-project') ) );
1111 $codevalue = strtolower( $wgRequest->getVal( 'rc-testwiki-code', $wgUser->getOption($wmincPref . '-code') ) );
12 - $fullprefix = 'W' . $projectvalue . '/' . $codevalue;
 12+ $fullprefix = IncubatorTest::displayPrefix( $projectvalue, $codevalue );
1313 $opts->add( 'rc-testwiki-project', false );
1414 $opts->setValue( 'rc-testwiki-project', $projectvalue );
1515 $opts->add( 'rc-testwiki-code', false );
1616 $opts->setValue( 'rc-testwiki-code', $codevalue );
17 - if ( $projectvalue == 'none' OR $projectvalue == '' ) {
 17+ if ( $projectvalue == 'none' || $projectvalue == '' ) {
1818 // If "none" is selected, display normal recent changes
1919 return true;
2020 } elseif ( $projectvalue == $wmincProjectSite['short'] ) {
@@ -23,8 +23,7 @@
2424 } else {
2525 // Else, display changes to the selected test wiki (in main, template and category namespace)
2626 $dbr = wfGetDB( DB_SLAVE );
27 - $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
28 - $conds[] = 'rc_namespace IN (' . $dbr->makeList( $namespaces ) . ')';
 27+ $conds['rc_namespace'] = $wmincTestWikiNamespaces;
2928 $conds[] = 'rc_title ' . $dbr->buildLike( $fullprefix . '/', $dbr->anyString() ) .
3029 ' OR rc_title = ' . $dbr->addQuotes( $fullprefix );
3130 return true;
@@ -32,7 +31,7 @@
3332 }
3433
3534 static function onRcForm( &$items, $opts ) {
36 - global $wgUser, $wgRequest, $wmincPref, $wmincProjects, $wmincProjectSite;
 35+ global $wgUser, $wgRequest, $wmincPref, $wmincProjects, $wmincProjectSite, $wmincLangCodeLength;
3736
3837 $projectvalue = $wgRequest->getVal( 'rc-testwiki-project', $wgUser->getOption($wmincPref . '-project') );
3938 $langcodevalue = $wgRequest->getVal( 'rc-testwiki-code', $wgUser->getOption($wmincPref . '-code') );
@@ -45,7 +44,8 @@
4645 $select->addOption( $name, $prefix );
4746 }
4847 $select->addOption( $wmincProjectSite['name'], $wmincProjectSite['short'] );
49 - $langcode = Xml::input( 'rc-testwiki-code', 3, $langcodevalue, array( 'id' => 'rc-testwiki-code', 'maxlength' => 3 ) );
 48+ $langcode = Xml::input( 'rc-testwiki-code', (int)$wmincLangCodeLength, $langcodevalue,
 49+ array( 'id' => 'rc-testwiki-code', 'maxlength' => (int)$wmincLangCodeLength ) );
5050 $items['testwiki'] = array( $label, $select->getHTML() . ' ' . $langcode );
5151 return true;
5252 }

Status & tagging log