http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88490

Revision: 88490
Author:   robin
Date:     2011-05-20 21:34:44 +0000 (Fri, 20 May 2011)
Log Message:
-----------
* Code improvements after review by Roan Kattouw
* Introduce validateLanguageCode() and validatePrefix()

Modified Paths:
--------------
    trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
    trunk/extensions/WikimediaIncubator/IncubatorTest.php
    trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php
    trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
    trunk/extensions/WikimediaIncubator/TestWikiRC.php
    trunk/extensions/WikimediaIncubator/WikimediaIncubator.php

Modified: trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
===================================================================
--- trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php       
2011-05-20 21:34:21 UTC (rev 88489)
+++ trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php       
2011-05-20 21:34:44 UTC (rev 88490)
@@ -7,11 +7,11 @@
 * change their preferences (automatically is always better :p)
 */
 class AutoTestWiki {
-       function onUserCreateForm( $template ) {
+       public static function onUserCreateForm( $template ) {
                global $wgRequest, $wmincProjects;
                $projectvalue = strtolower( $wgRequest->getVal( 
'testwikiproject', '' ) );
                $codevalue = strtolower( $wgRequest->getVal( 'testwikicode', '' 
) );
-               if ( preg_match( '/[a-z][a-z][a-z]?/', $codevalue ) && 
in_array( $projectvalue, (array)$wmincProjects ) ) {
+               if ( IncubatorTest::validateLanguageCode( $codevalue ) && 
in_array( $projectvalue, (array)$wmincProjects ) ) {
                        $template->set( 'header',
                                Html::hidden('testwiki-project', $projectvalue).
                                Html::hidden('testwiki-code', $codevalue)
@@ -20,13 +20,13 @@
                return true;
        }
 
-       function onAddNewAccount( $user ) {
-               global $wgRequest, $wmincPref;
-               $getprojectvalue = $wgRequest->getVal( 'testwiki-project' );
-               $getcodevalue = $wgRequest->getVal( 'testwiki-code' );
-               if ( $getprojectvalue && $getcodevalue ) {
-                       $user->setOption( $wmincPref . '-project', 
$getprojectvalue );
-                       $user->setOption( $wmincPref . '-code', $getcodevalue );
+       public static function onAddNewAccount( $user ) {
+               global $wgRequest, $wmincProjects, $wmincPref;
+               $projectvalue = $wgRequest->getVal( 'testwiki-project' );
+               $codevalue = $wgRequest->getVal( 'testwiki-code' );
+               if ( IncubatorTest::validateLanguageCode( $codevalue ) && 
in_array( $projectvalue, (array)$wmincProjects ) ) {
+                       $user->setOption( $wmincPref . '-project', 
$projectvalue );
+                       $user->setOption( $wmincPref . '-code', $codevalue );
                        $user->saveSettings();
                }
                return true;

Modified: trunk/extensions/WikimediaIncubator/IncubatorTest.php
===================================================================
--- trunk/extensions/WikimediaIncubator/IncubatorTest.php       2011-05-20 
21:34:21 UTC (rev 88489)
+++ trunk/extensions/WikimediaIncubator/IncubatorTest.php       2011-05-20 
21:34:44 UTC (rev 88490)
@@ -6,7 +6,8 @@
 class IncubatorTest
 {
        static function onGetPreferences( $user, &$preferences ) {
-               global $wmincPref, $wmincProjects, $wmincProjectSite, 
$wmincPrefProject, $wmincPrefNone, $wgDefaultUserOptions;
+               global $wmincPref, $wmincProjects, $wmincProjectSite,
+                       $wmincLangCodeLength, $wgDefaultUserOptions;
 
                $preferences['language']['help-message'] = 
'wminc-prefinfo-language';
 
@@ -24,10 +25,10 @@
                        'section' => 'personal/i18n',
                        'label-message' => 'wminc-testwiki',
                        'id' => $wmincPref . '-code',
-                       'maxlength' => 3,
-                       'size' => 3,
+                       'maxlength' => (int)$wmincLangCodeLength,
+                       'size' => (int)$wmincLangCodeLength,
                        'help-message' => 'wminc-prefinfo-code',
-                       'validation-callback' => array( 'IncubatorTest', 
'CodeValidation' ),
+                       'validation-callback' => array( 'IncubatorTest', 
'validateCodePreference' ),
                );
 
                $wgDefaultUserOptions[$wmincPref . '-project'] = 'none';
@@ -37,7 +38,7 @@
                return true;
        }
 
-       function codeValidation( $input, $alldata ) {
+       static function validateCodePreference( $input, $alldata ) {
                global $wmincPref, $wmincProjects;
                // If the user selected a project that NEEDS a language code, 
but the user DID NOT enter a language code, give an error
                if ( isset( $alldata[$wmincPref.'-project'] ) && in_array( 
$alldata[$wmincPref.'-project'], $wmincProjects ) && !$input ) {
@@ -47,48 +48,89 @@
                }
        }
 
-       function isNormalPrefix() {
+       /*
+       * This validates a language code. Currently it is set
+       * to only allow two or three-letter codes strictly, but
+       * it can be changed when the policy changes.
+       * See also $wmincLangCodeLength.
+       */
+       static function validateLanguageCode( $code ) {
+               return (bool) preg_match( '/[a-z][a-z][a-z]?/', $code );
+       }
+
+       /*
+       * Same as above, but for full prefix in a given title.
+       * @param $onlyprefix Bool Whether to validate only the prefix, or
+       * also allow other text within the page title (Wx/xxx vs Wx/xxx/Text)
+       */
+       static function validatePrefix( $title, $onlyprefix = false ) {
+               global $wmincProjects;
+               $listProjects = implode( '', $wmincProjects ); // something 
like: pbtqn
+               return (bool) preg_match( 
'/^W['.$listProjects.']\/[a-z][a-z][a-z]?' .
+                       ($onlyprefix ? '' : '' ) . '/', $title );
+       }
+
+       /* 
+       * Returns true if the given project (or preference
+       * by default) is one of the projects using the
+       * format Wx/xxx (as defined in $wmincProjects)
+       */
+       static function isContentProject( $project = '' ) {
                global $wgUser, $wmincPref, $wmincProjects;
-               if ( in_array( $wgUser->getOption($wmincPref . '-project'), 
$wmincProjects ) ) {
-                       return true; // true because this is a normal prefix
-               } else {
-                       return false; // false because this is NOT a normal 
prefix
-               }
+               $project = ($project ? $project : $wgUser->getOption($wmincPref 
. '-project') );
+               return (bool) in_array( $project, $wmincProjects );
        }
 
-       function displayPrefix() {
-               // display the prefix of the user preference
+       /*
+       * display the prefix by the given project and code
+       * (or the user preference if no parameters are given)
+       */
+       static function displayPrefix( $project = '', $code = '' ) {
                global $wgUser, $wmincPref;
-               if ( self::isNormalPrefix() == true ) {
-                       return 'W' . $wgUser->getOption($wmincPref . 
'-project') . '/' . $wgUser->getOption($wmincPref . '-code'); // return the 
prefix
+               if ( self::isContentProject() ) {
+                       // return the prefix
+                       return 'W' . ( $project ? $project : 
$wgUser->getOption($wmincPref . '-project') ) .
+                               '/' . ( $code ? $code : 
$wgUser->getOption($wmincPref . '-code') ); // return the prefix
                } else {
-                       return $wgUser->getOption($wmincPref . '-project'); // 
still provide the value
+                       // still provide the value
+                       return $wgUser->getOption($wmincPref . '-project');
                }
        }
 
-       function displayPrefixedTitle( $title, $namespace = '' ) {
-               global $wgUser, $wmincPref;
-               $out = '';
-               if ( self::isNormalPrefix() ) {
-                       if ( $namespace ) { $out .= $namespace . ':'; }
-                       $out .= self::displayPrefix() . '/' . $title;
+       /*
+       * Makes a full prefixed title of a given page title and namespace
+       * @param $ns Tnt numeric value of namespace
+       */
+       static function displayPrefixedTitle( $title, $ns = 0 ) {
+               global $wgLang, $wmincTestWikiNamespaces;
+               if( in_array( $ns, $wmincTestWikiNamespaces ) ) {
+                       /* Standard namespace as defined by
+                       * $wmincTestWikiNamespaces, so use format:
+                       * TITLE + NS => NS:Wx/xxx/TITLE
+                       */
+                       $title = Title::makeTitleSafe( $ns, 
self::displayPrefix() . '/' . $title );
                } else {
-                       $out .= self::displayPrefix();
+                       /* Non-standard namespace, so use format:
+                       * TITLE + NS => Wx/xxx/NS:TITLE
+                       * (with localized namespace name)
+                       */
+                       $title = Title::makeTitleSafe( NULL, 
self::displayPrefix() . '/' .
+                               $wgLang->getNsText( $ns ) . ':' . $title );
                }
-               return $out;
+               return $title;
        }
 
-       function magicWordVariable( &$magicWords ) {
+       static function magicWordVariable( &$magicWords ) {
                $magicWords[] = 'usertestwiki';
                return true;
        }
 
-       function magicWord( &$magicWords, $langCode ) {
+       static function magicWord( &$magicWords, $langCode ) {
                $magicWords['usertestwiki'] = array( 0, 'USERTESTWIKI' );
                return true;
        }
 
-       function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret ) {
+       static function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret 
) {
                if( !self::displayPrefix() ) {
                        $ret = 'none';
                } else {
@@ -97,55 +139,57 @@
                return true;
        }
 
-       function editPageCheckPrefix( $editpage ) {
+       static function checkPrefixOnEditPage( $editpage ) {
+               global $wmincProjectSite;
                // If user has "project" as test wiki preference, it isn't 
needed to check
-               if ( self::displayPrefix() == 'inc' ) {
+               if ( self::displayPrefix() == $wmincProjectSite['short'] ) {
                        return true;
                }
-               global $wgTitle;
-               $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, 
NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
-               // If it is in one of the above namespace, check if the page 
title has a prefix
-               if ( in_array( $wgTitle->getNamespace(), $namespaces ) && 
!preg_match( '/W[bnpqt]\/[a-z][a-z][a-z]?/', $wgTitle->getText() ) ) {
-                       global $wgOut;
-                       
-                               $warning = '<div id="wminc-warning"><span 
id="wm-warning-unprefixed">'
-                                       . wfMsg( 'wminc-warning-unprefixed' )
+               global $wgTitle, $wmincTestWikiNamespaces;
+               $title = $wgTitle->getText();
+               $ns = $wgTitle->getNamespace();
+               // If it's in one of the content namespaces or if the page 
title has a prefix, return
+               if ( !in_array( $ns, $wmincTestWikiNamespaces ) || 
self::validatePrefix( $title ) ) {
+                       return true;
+               }
+               $warning = '<div id="wminc-warning"><span 
id="wm-warning-unprefixed">'
+                       . wfMsg( 'wminc-warning-unprefixed' )
+                       . '</span>';
+               // If the user has a test wiki pref, suggest a page title with 
prefix
+               if ( self::isContentProject() ) {
+                       global $wgUser;
+                       $suggest = self::displayPrefixedTitle( $title, $ns );
+                       if ( !$wgTitle->exists() ) { // Creating a page, so 
suggest to create a prefixed page
+                               $warning .= ' <span id="wminc-warning-suggest">'
+                                       . wfMsg( 'wminc-warning-suggest', 
$suggest )
                                        . '</span>';
-                               // If the user has a test wiki pref, suggest a 
page title with prefix
-                               if ( self::isNormalPrefix() ) {
-                                       global $wgUser;
-                                       $suggest = self::displayPrefixedTitle( 
$wgTitle->getText(), $wgTitle->getNsText() );
-                                       if ( !$wgTitle->exists() ) { // 
Creating a page, so suggest to create a prefixed page
-                                       $warning .= ' <span 
id="wminc-warning-suggest">'
-                                               . wfMsg( 
'wminc-warning-suggest', $suggest )
-                                               . '</span>';
-                                       } elseif ( $wgUser->isAllowed( 'move' ) 
) { // Page exists, so suggest to move
-                                       $warning .= ' <span 
id="wminc-warning-suggest-move" class="plainlinks">'
-                                               . wfMsg( 
'wminc-warning-suggest-move', $suggest, urlencode( $suggest ), urlencode( 
$wgTitle ) )
-                                               . '</span>';
-                                       }
-                               }
-                               $warning .= '</div>';
-                       $wgOut->addWikiText( $warning );
+                       } elseif ( $wgUser->isAllowed( 'move' ) ) { // Page 
exists, so suggest to move
+                               $warning .= ' <span 
id="wminc-warning-suggest-move" class="plainlinks">'
+                                       . wfMsg( 'wminc-warning-suggest-move', 
$suggest, wfUrlencode( $suggest ), wfUrlencode( $wgTitle ) )
+                                       . '</span>';
+                       }
                }
+               $warning .= '</div>';
+               global $wgOut;
+               $wgOut->addWikiText( $warning );
                return true;
        }
-}
 
-/**
- * Add a link to Special:ViewUserLang from Special:Contributions/USERNAME
- * if the user has 'viewuserlang' permission
-  * Based on code from extension LookupUser made by Tim Starling
- * @return true
- */
-function efLoadViewUserLangLink( $id, $nt, &$links ) {
-       global $wgUser;
-       if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
-               
-               $links[] = $wgUser->getSkin()->makeKnownLinkObj(
-                                       SpecialPage::getTitleFor( 
'ViewUserLang' ),
-                                       wfMsgHtml( 'wminc-viewuserlang' ),
-                                       '&target=' . urlencode( $nt->getText() 
) );
+       /**
+       * Add a link to Special:ViewUserLang from Special:Contributions/USERNAME
+       * if the user has 'viewuserlang' permission
+       * Based on code from extension LookupUser made by Tim Starling
+       * @return true
+       */
+       static function efLoadViewUserLangLink( $id, $nt, &$links ) {
+               global $wgUser;
+               if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
+                       $user = wfUrlencode( $nt->getText() );
+                       $links[] = $wgUser->getSkin()->link(
+                               SpecialPage::getTitleFor( 'ViewUserLang', $user 
),
+                               wfMsgHtml( 'wminc-viewuserlang' )
+                       );
+               }
+               return true;
        }
-       return true;
-}
+}
\ No newline at end of file

Modified: trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php
===================================================================
--- trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php 2011-05-20 
21:34:21 UTC (rev 88489)
+++ trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php 2011-05-20 
21:34:44 UTC (rev 88490)
@@ -8,7 +8,7 @@
 {
        public function __construct() {
                global $wgUser, $wmincPref, $wmincProjectSite;
-               if(IncubatorTest::isNormalPrefix()) {
+               if( IncubatorTest::isContentProject() ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        $this->extra[] = 'page_title' .
                                $dbr->buildLike( IncubatorTest::displayPrefix() 
. '/', $dbr->anyString() );

Modified: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
===================================================================
--- trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php 2011-05-20 
21:34:21 UTC (rev 88489)
+++ trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php 2011-05-20 
21:34:44 UTC (rev 88490)
@@ -32,11 +32,7 @@
                        return;
                }
 
-               if ( $subpage ) {
-                       $target = $subpage;
-               } else {
-                       $target = $wgRequest->getText( 'target' );
-               }
+               $target = $wgRequest->getText( 'target', $subpage );
 
                $this->showForm( $target );
 
@@ -53,13 +49,13 @@
                global $wgScript, $wgOut;
 
                $wgOut->addHTML(
-                       Xml::fieldset( wfMsg( 'wminc-viewuserlang' ) ) .
+                       Xml::fieldset( wfMsgHtml( 'wminc-viewuserlang' ) ) .
                        Xml::openElement( 'form', array( 'method' => 'get', 
'action' => $wgScript ) ) .
                        Html::hidden( 'title', 
$this->getTitle()->getPrefixedText() ) .
                        "<p>" .
-                               Xml::inputLabel( wfMsg( 
'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
+                               Xml::inputLabel( wfMsgHtml( 
'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
                                ' ' .
-                               Xml::submitButton( wfMsg( 
'wminc-viewuserlang-go' ) ) .
+                               Xml::submitButton( wfMsgHtml( 
'wminc-viewuserlang-go' ) ) .
                        "</p>" .
                        Xml::closeElement( 'form' ) .
                        Xml::closeElement( 'fieldset' )
@@ -79,22 +75,21 @@
                        // show error if a user with that name does not exist
                        $wgOut->addHTML( Xml::span( wfMsg( 
'wminc-userdoesnotexist', $target ), 'error' ) );
                } else {
-                       if ( IncubatorTest::isNormalPrefix() == true ) {
-                               $testwiki = Linker::link( 'W' . 
$user->getOption($wmincPref . '-project') .
-                                       '/' . $user->getOption($wmincPref . 
'-code') );
+                       if ( IncubatorTest::isContentProject() ) {
+                               $testwiki = $sk->link( Title::newFromText( 
IncubatorTest::displayPrefix() ) );
                        } elseif ( IncubatorTest::displayPrefix() == 
$wmincProjectSite['short'] ) {
-                               $testwiki = $wmincProjectSite['name'];
+                               $testwiki = htmlspecialchars( 
$wmincProjectSite['name'] );
                        } else {
-                               $testwiki = wfMsg( 'wminc-testwiki-none' );
+                               $testwiki = wfMsgHtml( 'wminc-testwiki-none' );
                        }
                        $name = $user->getName();
                        $wgOut->addHtml(
                                Xml::openElement( 'ul' ) .
-                               '<li>' . wfMsg( 'username' ) . ' ' .
+                               '<li>' . wfMsgHtml( 'username' ) . ' ' .
                                        $sk->userLink( $name, $name ) . 
$sk->userToolLinks( $name, $name ) . '</li>' .
-                               '<li>' . wfMsg( 'loginlanguagelabel', 
$langNames[$user->getOption( 'language' )] .
+                               '<li>' . wfMsgHtml( 'loginlanguagelabel', 
$langNames[$user->getOption( 'language' )] .
                                        ' (' . $user->getOption( 'language' ) . 
')' ) . '</li>' .
-                               '<li>' . wfMsg( 'wminc-testwiki' ) . ' ' . 
$testwiki . '</li>' .
+                               '<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . 
$testwiki . '</li>' .
                                Xml::closeElement( 'ul' )
                        );
                }

Modified: trunk/extensions/WikimediaIncubator/TestWikiRC.php
===================================================================
--- trunk/extensions/WikimediaIncubator/TestWikiRC.php  2011-05-20 21:34:21 UTC 
(rev 88489)
+++ trunk/extensions/WikimediaIncubator/TestWikiRC.php  2011-05-20 21:34:44 UTC 
(rev 88490)
@@ -5,15 +5,15 @@
 
 class TestWikiRC {
        static function onRcQuery( &$conds, &$tables, &$join_conds, $opts ) {
-               global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite;
+               global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite, 
$wmincTestWikiNamespaces;
                $projectvalue = strtolower( $wgRequest->getVal( 
'rc-testwiki-project', $wgUser->getOption($wmincPref . '-project') ) );
                $codevalue = strtolower( $wgRequest->getVal( 
'rc-testwiki-code', $wgUser->getOption($wmincPref . '-code') ) );
-               $fullprefix = 'W' . $projectvalue . '/' . $codevalue;
+               $fullprefix = IncubatorTest::displayPrefix( $projectvalue, 
$codevalue );
                $opts->add( 'rc-testwiki-project', false );
                $opts->setValue( 'rc-testwiki-project', $projectvalue );
                $opts->add( 'rc-testwiki-code', false );
                $opts->setValue( 'rc-testwiki-code', $codevalue );
-               if ( $projectvalue == 'none' OR $projectvalue == '' ) {
+               if ( $projectvalue == 'none' || $projectvalue == '' ) {
                        // If "none" is selected, display normal recent changes
                        return true;
                } elseif ( $projectvalue == $wmincProjectSite['short'] ) {
@@ -23,8 +23,7 @@
                } else {
                        // Else, display changes to the selected test wiki (in 
main, template and category namespace)
                        $dbr = wfGetDB( DB_SLAVE );
-                       $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, 
NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
-                       $conds[] = 'rc_namespace IN (' . $dbr->makeList( 
$namespaces ) . ')';
+                       $conds['rc_namespace'] = $wmincTestWikiNamespaces;
                        $conds[] = 'rc_title ' . $dbr->buildLike( $fullprefix . 
'/', $dbr->anyString() ) .
                        ' OR rc_title = ' . $dbr->addQuotes( $fullprefix );
                        return true;
@@ -32,7 +31,7 @@
        }
 
        static function onRcForm( &$items, $opts ) {
-               global $wgUser, $wgRequest, $wmincPref, $wmincProjects, 
$wmincProjectSite;
+               global $wgUser, $wgRequest, $wmincPref, $wmincProjects, 
$wmincProjectSite, $wmincLangCodeLength;
                
                $projectvalue = $wgRequest->getVal( 'rc-testwiki-project', 
$wgUser->getOption($wmincPref . '-project') );
                $langcodevalue = $wgRequest->getVal( 'rc-testwiki-code', 
$wgUser->getOption($wmincPref . '-code') );
@@ -45,7 +44,8 @@
                        $select->addOption( $name, $prefix );
                }
                $select->addOption( $wmincProjectSite['name'], 
$wmincProjectSite['short'] );
-               $langcode = Xml::input( 'rc-testwiki-code', 3, $langcodevalue, 
array( 'id' => 'rc-testwiki-code', 'maxlength' => 3 ) );
+               $langcode = Xml::input( 'rc-testwiki-code', 
(int)$wmincLangCodeLength, $langcodevalue,
+                       array( 'id' => 'rc-testwiki-code', 'maxlength' => 
(int)$wmincLangCodeLength ) );
                $items['testwiki'] = array( $label, $select->getHTML() . ' ' . 
$langcode );
                return true;
        }

Modified: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
===================================================================
--- trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2011-05-20 
21:34:21 UTC (rev 88489)
+++ trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2011-05-20 
21:34:44 UTC (rev 88490)
@@ -11,7 +11,7 @@
        'path' => __FILE__,
        'name' => 'Wikimedia Incubator',
        'author' => 'SPQRobin',
-       'version' => '2.4',
+       'version' => '3.0',
        'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
        'descriptionmsg' => 'wminc-desc',
 );
@@ -20,7 +20,7 @@
 $wgGroupPermissions['*']['viewuserlang'] = false;
 $wgGroupPermissions['sysop']['viewuserlang'] = true;
 
-/* General (kind of globals) */
+/* General (globals and/or configuration) */
 $wmincPref = 'incubatortestwiki'; // Name of the preference
 $dir = dirname( __FILE__ ) . '/';
 $wmincProjects = array(
@@ -34,6 +34,12 @@
        'name' => 'Incubator',
        'short' => 'inc',
 );
+$wmincTestWikiNamespaces = array(
+       NS_MAIN, NS_TALK,
+       NS_TEMPLATE, NS_TEMPLATE_TALK,
+       NS_CATEGORY, NS_CATEGORY_TALK,
+);
+$wmincLangCodeLength = 3; // can be increased if needed (depends on policy)
 
 $wgExtensionMessagesFiles['WikimediaIncubator'] = $dir . 
'WikimediaIncubator.i18n.php';
 
@@ -42,7 +48,7 @@
 $wgSpecialPages['ViewUserLang'] = 'SpecialViewUserLang';
 $wgSpecialPageGroups['ViewUserLang'] = 'users';
 $wgAvailableRights[] = 'viewuserlang';
-$wgHooks['ContributionsToolLinks'][] = 'efLoadViewUserLangLink';
+$wgHooks['ContributionsToolLinks'][] = 'IncubatorTest::efLoadViewUserLangLink';
 
 /* TestWiki preference */
 $wgAutoloadClasses['IncubatorTest'] = $dir . 'IncubatorTest.php';
@@ -52,7 +58,7 @@
 $wgHooks['ParserGetVariableValueSwitch'][] = 'IncubatorTest::magicWordValue';
 
 /* Edit page */
-$wgHooks['EditPage::showEditForm:initial'][] = 
'IncubatorTest::editPageCheckPrefix';
+$wgHooks['EditPage::showEditForm:initial'][] = 
'IncubatorTest::checkPrefixOnEditPage';
 
 /* Recent Changes */
 $wgAutoloadClasses['TestWikiRC'] = $dir . 'TestWikiRC.php';


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to