r105776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105775‎ | r105776 | r105777 >
Date:00:32, 11 December 2011
Author:siebrand
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/CreateAccountTestWiki.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.css (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/ListUsersTestWiki.php (added) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/SpecialRandomByTest.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/SpecialViewUserLang.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/WikimediaIncubator/WikimediaIncubator.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.css
@@ -50,6 +50,6 @@
5151 #ca-nstab-main a {
5252 color: black;
5353 }
54 -.subpages {
55 - display: none;
 54+span.subpages {
 55+ display: none !important;
5656 }
\ No newline at end of file
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/WikimediaIncubator.php
@@ -5,6 +5,8 @@
66 * for a test wiki system (i.e. incubated wikis inside one actual wiki)
77 * mainly intended for the Wikimedia Incubator
88 *
 9+ * MediaWiki 1.18 or higher required
 10+ *
911 * @file
1012 * @ingroup Extensions
1113 * @author Robin Pepermans (SPQRobin)
@@ -14,8 +16,8 @@
1517 'path' => __FILE__,
1618 'name' => 'Wikimedia Incubator',
1719 'author' => 'SPQRobin',
18 - 'version' => '4.3.2',
19 - 'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
 20+ 'version' => '4.5',
 21+ 'url' => '//www.mediawiki.org/wiki/Extension:WikimediaIncubator',
2022 'descriptionmsg' => 'wminc-desc',
2123 );
2224
@@ -64,6 +66,7 @@
6567 $wgGroupPermissions['test-sysop']['block'] = true;
6668 $wgGroupPermissions['test-sysop']['blockemail'] = true;
6769 $wgGroupPermissions['test-sysop']['rollback'] = true;
 70+$wgGroupPermissions['test-sysop']['suppressredirect'] = true;
6871 $wgAddGroups['bureaucrat'][] = 'test-sysop';
6972 $wgRemoveGroups['bureaucrat'][] = 'test-sysop';
7073
@@ -141,3 +144,14 @@
142145
143146 /* Set page content language depending on the prefix */
144147 $wgHooks['PageContentLanguage'][] = 'IncubatorTest::onPageContentLanguage';
 148+
 149+/* List of users */
 150+$wgAutoloadClasses['ListUsersTestWiki'] = $dir . 'ListUsersTestWiki.php';
 151+$wgHooks['SpecialListusersHeaderForm'][] = 'ListUsersTestWiki::onSpecialListusersHeaderForm';
 152+$wgHooks['SpecialListusersQueryInfo'][] = 'ListUsersTestWiki::onSpecialListusersQueryInfo';
 153+$wgHooks['SpecialListusersHeader'][] = 'ListUsersTestWiki::onSpecialListusersHeader';
 154+
 155+/* Search in test wiki */
 156+$wgHooks['SpecialSearchCreateLink'][] = 'IncubatorTest::onSpecialSearchCreateLink';
 157+$wgHooks['SpecialSearchPowerBox'][] = 'IncubatorTest::onSpecialSearchPowerBox';
 158+$wgHooks['SpecialSearchSetupEngine'][] = 'IncubatorTest::onSpecialSearchSetupEngine';
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/SpecialRandomByTest.php
@@ -20,12 +20,8 @@
2121 $this->extra[] = 'page_title' .
2222 $dbr->buildLike( IncubatorTest::displayPrefix( $project, $lang ) . '/', $dbr->anyString() );
2323 } elseif( $wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) {
24 - global $wgVersion;
25 - # only works above MW 1.17
26 - if( version_compare($wgVersion, '1.17', '>') ) {
27 - # project or help namespace
28 - $this->extra['page_namespace'] = array( 4, 12 );
29 - }
 24+ # project or help namespace
 25+ $this->extra['page_namespace'] = array( 4, 12 );
3026 }
3127 parent::__construct( 'RandomByTest' );
3228 }
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/SpecialViewUserLang.php
@@ -16,6 +16,9 @@
1717 parent::__construct( 'ViewUserLang', 'viewuserlang' );
1818 }
1919
 20+ /**
 21+ * @return String
 22+ */
2023 function getDescription() { return wfMsg( 'wminc-viewuserlang' ); }
2124
2225 /**
@@ -70,7 +73,8 @@
7174 global $wgOut, $wmincPref, $wmincProjectSite;
7275 if( User::isIP( $target ) ) {
7376 # show error if it is an IP address
74 - return $wgOut->addHTML( Xml::span( wfMsg( 'wminc-ip', $target ), 'error' ) );
 77+ $wgOut->addHTML( Xml::span( wfMsg( 'wminc-ip', $target ), 'error' ) );
 78+ return;
7579 }
7680 $user = User::newFromName( $target );
7781 $name = $user->getName();
@@ -79,7 +83,8 @@
8084 $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
8185 if ( $user == null || $id == 0 ) {
8286 # show error if a user with that name does not exist
83 - return $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) );
 87+ $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) );
 88+ return;
8489 }
8590 $userproject = $user->getOption( $wmincPref . '-project' );
8691 $userproject = ( $userproject ? $userproject : 'none' );
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/ListUsersTestWiki.php
@@ -0,0 +1,77 @@
 2+<?php
 3+
 4+/**
 5+ * Ability to filter list of users based on their test wiki preference
 6+ */
 7+class ListUsersTestWiki {
 8+ /**
 9+ * If the &testwiki= parameter matches the project site (Incubator), return that
 10+ * @return Array or null
 11+ */
 12+ static function getProjectInput() {
 13+ global $wmincProjectSite, $wgRequest;
 14+ $input = strtolower( $wgRequest->getVal( 'testwiki' ) );
 15+ if( $input == strtolower( $wmincProjectSite['name'] ) || $input == strtolower( $wmincProjectSite['short'] ) ) {
 16+ return $wmincProjectSite;
 17+ }
 18+ return null;
 19+ }
 20+
 21+ /**
 22+ * Input form
 23+ */
 24+ static function onSpecialListusersHeaderForm( $pager, &$out ) {
 25+ $testwiki = IncubatorTest::getUrlParam();
 26+ $project = self::getProjectInput();
 27+ $input = $project ? $project['name'] : ( $testwiki ? $testwiki['prefix'] : null );
 28+ $out .= Xml::label( wfMsg( 'wminc-testwiki' ), 'testwiki' ) . ' ' .
 29+ Xml::input( 'testwiki', 20, $input, array( 'id' => 'testwiki' ) ) . '<br />';
 30+ return true;
 31+ }
 32+
 33+ /**
 34+ * Show a message that you are viewing a list of users of a certain test wiki
 35+ * @param $pager
 36+ * @param $out
 37+ * @return bool
 38+ */
 39+ static function onSpecialListusersHeader( $pager, &$out ) {
 40+ $project = self::getProjectInput();
 41+ if( $project ) {
 42+ $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', '"' . $project['name'] . '"' );
 43+ } else {
 44+ $testwiki = IncubatorTest::getUrlParam();
 45+ if ( $testwiki ) {
 46+ $link = Linker::linkKnown( Title::newFromText( $testwiki['prefix'] ) );
 47+ $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', $link );
 48+ }
 49+ }
 50+ return true;
 51+ }
 52+
 53+ /**
 54+ * Query
 55+ */
 56+ static function onSpecialListusersQueryInfo( $pager, &$query ) {
 57+ $testwiki = IncubatorTest::getUrlParam();
 58+ $project = self::getProjectInput();
 59+ if( !$project && !$testwiki ) {
 60+ return true; # no input or invalid input
 61+ }
 62+ global $wmincPref;
 63+ $query['tables']['p1'] = 'user_properties';
 64+ $query['join_conds']['p1'] = array( 'JOIN', array( 'user_id=p1.up_user',
 65+ 'p1.up_property' => "$wmincPref-project",
 66+ 'p1.up_value' => $project ? $project['short'] : $testwiki['project']
 67+ ) );
 68+ if( $project ) {
 69+ return true; # project site doesn't need language code = returning
 70+ }
 71+ $query['tables']['p2'] = 'user_properties';
 72+ $query['join_conds']['p2'] = array( 'JOIN', array( 'user_id=p2.up_user',
 73+ 'p2.up_property' => "$wmincPref-code",
 74+ 'p2.up_value' => $testwiki['lang']
 75+ ) );
 76+ return true;
 77+ }
 78+}
Property changes on: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/ListUsersTestWiki.php
___________________________________________________________________
Added: svn:eol-style
179 + native
Added: svn:keywords
280 + Id
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/CreateAccountTestWiki.php
@@ -12,6 +12,11 @@
1313 */
1414
1515 class AutoTestWiki {
 16+
 17+ /**
 18+ * @param $template UsercreateTemplate|UserloginTemplate
 19+ * @return bool
 20+ */
1621 public static function onUserCreateForm( $template ) {
1722 global $wgRequest, $wmincProjects;
1823 $projectvalue = strtolower( $wgRequest->getVal( 'testwikiproject', '' ) );
@@ -25,6 +30,10 @@
2631 return true;
2732 }
2833
 34+ /**
 35+ * @param $user User
 36+ * @return bool
 37+ */
2938 public static function onAddNewAccount( $user ) {
3039 global $wgRequest, $wmincProjects, $wmincPref;
3140 $projectvalue = $wgRequest->getVal( 'testwiki-project' );
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/IncubatorTest.php
@@ -13,7 +13,9 @@
1414
1515 /**
1616 * Add preferences
17 - * @return True
 17+ * @param $user User
 18+ * @param $preferences array
 19+ * @return true
1820 */
1921 static function onGetPreferences( $user, &$preferences ) {
2022 global $wmincPref, $wmincProjects, $wmincProjectSite,
@@ -35,7 +37,7 @@
3638 $prefinsert[$wmincPref . '-code'] = array(
3739 'type' => 'text',
3840 'section' => 'personal/i18n',
39 - 'label-message' => 'wminc-testwiki',
 41+ 'label-message' => 'wminc-testwiki-code',
4042 'id' => $wmincPref . '-code',
4143 'maxlength' => (int)$wmincLangCodeLength,
4244 'size' => (int)$wmincLangCodeLength,
@@ -52,6 +54,8 @@
5355
5456 /**
5557 * For the preferences above
 58+ * @param $input
 59+ * @param $alldata
5660 * @return String or true
5761 */
5862 static function validateCodePreference( $input, $alldata ) {
@@ -135,15 +139,15 @@
136140
137141 /**
138142 * This returns simply true or false based on analyzePrefix().
 143+ * @param $title Title
 144+ * @param $onlyprefix bool
139145 * @return Boolean
140146 */
141147 static function validatePrefix( $title, $onlyprefix = false ) {
142148 $data = self::analyzePrefix( $title, $onlyprefix );
143 - if( !$data['error'] ) { return true; }
144 - return false;
 149+ return !$data['error'];
145150 }
146151
147 -
148152 /**
149153 * Get &testwiki=wx/xx and validate that prefix.
150154 * Returns the array of analyzePrefix() on success.
@@ -197,6 +201,10 @@
198202
199203 /**
200204 * Returns a simple boolean based on getProject()
 205+ * @param $project string
 206+ * @param $returnName bool
 207+ * @param $returnName bool
 208+ * @param $includeSister bool
201209 * @return Bool
202210 */
203211 static function isContentProject( $project = '', $returnName = false, $includeSister = false ) {
@@ -322,8 +330,10 @@
323331 $link = self::getSubdomain( $prefixdata['lang'],
324332 $prefixdata['project'], ( $title->getNsText() ? $title->getNsText() . ':' : '' ) .
325333 str_replace( ' ', '_', $prefixdata['realtitle'] ) );
 334+ # faking external link to support prot-rel URLs
 335+ $link = "[$link ". self::makeExternalLinkText( $link ) . "]";
326336 $result[] = array( 'wminc-error-wiki-exists', $link );
327 - return false;
 337+ return $action != 'edit';
328338 }
329339
330340 if( !self::shouldWeShowUnprefixedError( $title ) || $action != 'create' ) {
@@ -342,7 +352,7 @@
343353 $error = 'wminc-error-unprefixed';
344354 }
345355 $result = $error;
346 - return false;
 356+ return $action != 'edit';
347357 }
348358
349359 /**
@@ -379,18 +389,12 @@
380390
381391 /**
382392 * This loads language names. Also from CLDR if that extension is found.
383 - * @return Array with language names or empty array
 393+ * @return Array with language names
384394 */
385 - static public function getLanguageNames( $code = '' ) {
386 - if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
387 - global $wgLang;
388 - $langcode = ( $code ? $code : $wgLang->getCode() );
389 - return LanguageNames::getNames( $langcode,
390 - LanguageNames::FALLBACK_NORMAL,
391 - LanguageNames::LIST_MW_AND_CLDR
392 - );
393 - }
394 - return Language::getLanguageNames( false );
 395+ static public function getLanguageNames( $code = null ) {
 396+ global $wgLang;
 397+ $langcode = ( $code ? $code : $wgLang->getCode() );
 398+ return Language::getTranslatedLanguageNames( $langcode );
395399 }
396400
397401 /**
@@ -404,7 +408,7 @@
405409 }
406410 return true; # Should work now
407411 }
408 -
 412+
409413 /**
410414 * Given an incubator testwiki prefix, get the database name of the
411415 * corresponding wiki, whether it exists or not
@@ -417,7 +421,11 @@
418422 } elseif( !$prefix || $prefix['error'] ) {
419423 return false; # shouldn't be, but you never know
420424 }
421 - global $wmincProjectDatabases;
 425+ global $wmincProjectDatabases, $wgDummyLanguageCodes;
 426+ $redirectcode = array_search( $prefix['lang'], $wgDummyLanguageCodes );
 427+ if( $redirectcode ) {
 428+ $prefix['lang'] = $redirectcode;
 429+ }
422430 return str_replace('-', '_', $prefix['lang'] ) .
423431 $wmincProjectDatabases[$prefix['project']];
424432 }
@@ -473,7 +481,6 @@
474482 if( $prefix['error'] ) { # We are not on info pages
475483 global $wmincSisterProjects;
476484 $prefix2 = self::analyzePrefix( $title->getText(), false, true );
477 - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
478485 $p = isset( $prefix2['project' ] ) ? $prefix2['project'] : '';
479486 if( self::getDBState( $prefix2 ) == 'existing' ) {
480487 $link = self::getSubdomain( $prefix2['lang'], $p,
@@ -484,7 +491,7 @@
485492 return true;
486493 } else {
487494 # Show a link to the existing wiki
488 - $showLink = $linker->makeExternalLink( $link, $link );
 495+ $showLink = self::makeExternalLinkText( $link, true );
489496 $wgOut->addHtml( '<div class="wminc-wiki-exists">' .
490497 wfMsgHtml( 'wminc-error-wiki-exists', $showLink ) .
491498 '</div>' );
@@ -493,7 +500,7 @@
494501 # A sister project is not hosted here, so direct the user to the relevant wiki
495502 $link = self::getSubdomain( $prefix2['lang'], $p,
496503 ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . $prefix2['realtitle'] );
497 - $showLink = $linker->makeExternalLink( $link, $link );
 504+ $showLink = self::makeExternalLinkText( $link, true );
498505 $wgOut->addHtml( '<div class="wminc-wiki-sister">' .
499506 wfMsgHtml( 'wminc-error-wiki-sister', $showLink ) .
500507 '</div>' );
@@ -528,7 +535,7 @@
529536 $wgOut->addHtml( $infopage->showExistingWiki() );
530537 } elseif( $dbstate == 'closed' ) {
531538 $infopage->mSubStatus = 'imported';
532 - $wgOut->addHtml( $infopage->showIncubatingWiki() );
 539+ $wgOut->addHtml( $infopage->showIncubatingWiki() );
533540 } else {
534541 $wgOut->addHtml( $infopage->showMissingWiki() );
535542 }
@@ -579,12 +586,15 @@
580587
581588 /**
582589 * make "Wx/xxx/Main Page"
583 - * @return String
 590+ * @param $langCode String: The language code
 591+ * @param $prefix Null|String: the "Wx/xxx" prefix to add
 592+ * @return Title
584593 */
585594 public static function getMainPage( $langCode, $prefix = null ) {
586595 # Take the "mainpage" msg in the given language
587596 $msg = wfMsgExt( 'mainpage', array( 'language' => $langCode ) );
588 - return $prefix !== null ? $prefix . '/' . $msg : $msg;
 597+ $mainpage = $prefix !== null ? $prefix . '/' . $msg : $msg;
 598+ return Title::newFromText( $mainpage );
589599 }
590600
591601 /**
@@ -612,9 +622,7 @@
613623 # pass through the &uselang parameter
614624 $params['uselang'] = $uselang;
615625 }
616 - $mainpage = Title::newFromText(
617 - self::getMainPage( $prefix['lang'], $prefix['prefix'] )
618 - );
 626+ $mainpage = self::getMainPage( $prefix['lang'], $prefix['prefix'] );
619627 if( $mainpage->exists() ) {
620628 # Only redirect to the main page if that page exists
621629 $wgOut->redirect( $mainpage->getFullURL( $params ) );
@@ -701,7 +709,74 @@
702710 return true;
703711 }
704712
 713+ /**
 714+ * Search: Adapt the default message to show a more descriptive one,
 715+ * along with an adapted link.
 716+ * @return true
 717+ */
 718+ public static function onSpecialSearchCreateLink( $title, &$params ) {
 719+ if( $title->isKnown() ) {
 720+ return true;
 721+ }
 722+ global $wmincProjectSite, $wmincTestWikiNamespaces;
 723+ $prefix = self::displayPrefix();
 724+
 725+ $newNs = $title->getNamespace();
 726+ $newTitle = $title->getText();
 727+ if( $prefix == $wmincProjectSite['short'] ) {
 728+ $newNs = NS_PROJECT;
 729+ } else {
 730+ if( !in_array( $title->getNamespace(), $wmincTestWikiNamespaces ) ) {
 731+ $newNs = $wmincTestWikiNamespaces[0]; # no "valid" NS, should be main NS
 732+ }
 733+ $newTitle = $prefix . '/' . $newTitle;
 734+ }
 735+
 736+ $t = Title::newFromText( $newTitle, $newNs );
 737+ if( $t->isKnown() ) {
 738+ # use the default message if the suggested title exists
 739+ $params[0] = 'searchmenu-exists';
 740+ $params[1] = wfEscapeWikiText( $t->getPrefixedText() );
 741+ return true;
 742+ }
 743+ $params[] = wfEscapeWikiText( $t->getPrefixedText() );
 744+ $params[0] = $prefix ? 'wminc-search-nocreate-suggest' :'wminc-search-nocreate-nopref';
 745+ return true;
 746+ }
 747+
 748+ /**
 749+ * Search: Add an input form to enter a test wiki prefix.
 750+ * @return true
 751+ */
 752+ public static function onSpecialSearchPowerBox( &$showSections, $term, $opts ) {
 753+ $showSections['testwiki'] = Xml::label( wfMsg( 'wminc-testwiki' ), 'testwiki' ) . ' ' .
 754+ Xml::input( 'testwiki', 20, self::displayPrefix(), array( 'id' => 'testwiki' ) );
 755+ return true;
 756+ }
 757+
 758+ /**
 759+ * Search: Search by default in the test wiki of the user's preference (or url &testwiki).
 760+ * @return true
 761+ */
 762+ public static function onSpecialSearchSetupEngine( $search, $profile, $engine ) {
 763+ if( !isset( $search->prefix ) || !$search->prefix ) {
 764+ $search->prefix = self::displayPrefix();
 765+ }
 766+ return true;
 767+ }
 768+
705769 private static function preg_quote_slash( $str ) {
706770 return preg_quote( $str, '/' );
707771 }
 772+
 773+ /**
 774+ * @param $url String
 775+ * @param $callLinker Boolean Whether to call makeExternalLink()
 776+ */
 777+ public static function makeExternalLinkText( $url, $callLinker = false ) {
 778+ # when displaying a URL, if it contains 'http://' or 'https://' it's ok to leave it,
 779+ # but for protocol-relative URLs, it's nicer to remove the '//'
 780+ $linktext = ltrim( $url, '/' );
 781+ return $callLinker ? Linker::makeExternalLink( $url, $linktext ) : $linktext;
 782+ }
708783 }
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.i18n.php
@@ -25,7 +25,13 @@
2626 'wminc-logo-wikispecies' => 'WikiSpecies.svg', # only translate if necessary
2727 'wminc-logo-mediawiki' => 'MediaWiki.svg', # only translate if necessary
2828 'wminc-manual-url' => 'Help:Manual', # only translate if necessary
29 - 'wminc-infopage-title' => '$1 $2', # only translate if necessary
 29+ 'wminc-infopage-title-p' => 'Wikipedia $1',
 30+ 'wminc-infopage-title-b' => 'Wikibooks $1',
 31+ 'wminc-infopage-title-t' => 'Wiktionary $1',
 32+ 'wminc-infopage-title-q' => 'Wikiquote $1',
 33+ 'wminc-infopage-title-n' => 'Wikinews $1',
 34+ 'wminc-infopage-title-s' => 'Wikisource $1',
 35+ 'wminc-infopage-title-v' => 'Wikiversity $1',
3036 'wminc-infopage-welcome' => 'Welcome to the Wikimedia Incubator, a project of the Wikimedia Foundation ([[{{MediaWiki:Aboutpage}}|About]])',
3137
3238 'wminc-infopage-missingwiki-text' => 'A $1 in this language does not yet exist.',
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/InfoPage.php
@@ -19,6 +19,11 @@
2020 */
2121
2222 class InfoPage {
 23+
 24+ /**
 25+ * @param $title Title
 26+ * @param $prefixdata
 27+ */
2328 public function __construct( $title, $prefixdata ) {
2429 global $wmincProjects, $wmincSisterProjects;
2530 $this->mTitle = $title;
@@ -39,7 +44,7 @@
4045 $this->mLangNames = IncubatorTest::getLanguageNames();
4146 $this->mLangName = ( isset( $this->mLangNames[$this->mLangCode] ) ?
4247 $this->mLangNames[$this->mLangCode] : wfMsg( 'wminc-unknownlang', $this->mLangCode ) );
43 - $this->mFormatTitle = wfMsgHtml( 'wminc-infopage-title', $this->mProjectName, $this->mLangName );
 48+ $this->mFormatTitle = wfMsgHtml( 'wminc-infopage-title-' . $this->mProjectCode, $this->mLangName );
4449 return;
4550 }
4651
@@ -49,15 +54,14 @@
5055 * @return String
5156 */
5257 public function makeLogo( $project, $clickable = true, $width = 25, $height = '', $url = '', $args = array() ) {
53 - global $wgUser;
5458 $projectForFile = preg_replace('/ /', '-', strtolower( $project ) );
5559 $imageobj = wfFindFile( wfMsg( 'wminc-logo-' . $projectForFile ) );
5660 $useUrl = $url ? $url : IncubatorTest::getSubdomain( 'www', IncubatorTest::getProject( $project, false, true ) );
5761 if ( !$imageobj ) { # image not found
5862 if( !$clickable ) {
59 - return $logo;
 63+ return $logo; // FIXME: $logo is undefined
6064 }
61 - return $wgUser->getSkin()->makeExternalLink( $useUrl, $project, false );
 65+ return Linker::makeExternalLink( $useUrl, $project, false );
6266 }
6367 if( $clickable ) {
6468 $args['link-url'] = $useUrl;
@@ -68,7 +72,7 @@
6973 if( $height ) {
7074 $handlerParams['height'] = $height;
7175 }
72 - return $wgUser->getSkin()->makeImageLink2( $this->mTitle, $imageobj,
 76+ return Linker::makeImageLink2( $this->mTitle, $imageobj,
7377 array( 'alt' => $project, 'caption' => $project ) + $args, $handlerParams
7478 );
7579 }
@@ -80,6 +84,7 @@
8185 public function listOtherProjects() {
8286 global $wmincProjects, $wmincSisterProjects;
8387 $otherProjects = $wmincProjects + $wmincSisterProjects;
 88+ $listOtherProjects = array();
8489 foreach( $otherProjects as $code => $name ) {
8590 $listOtherProjects[$code] = '<li>' . $this->makeLogo( $name, true,
8691 75, null, IncubatorTest::getSubdomain( $this->mLangCode, $code ) ) . '</li>';
@@ -95,10 +100,11 @@
96101 */
97102 public function listMultilingualProjects() {
98103 global $wmincMultilingualProjects;
99 - if( !is_array( $wmincMultilingualProjects ) ) { return; }
 104+ if( !is_array( $wmincMultilingualProjects ) ) { return ''; }
 105+ $list = array();
100106 foreach( $wmincMultilingualProjects as $url => $name ) {
101107 $list[$url] = '<li>' . $this->makeLogo( $name, true,
102 - 75, null, 'http://'.$url.'/') . '</li>';
 108+ 75, null, '//'.$url.'/') . '</li>';
103109 }
104110 return '<ul class="wminc-infopage-multilingualprojects">' .
105111 implode( '', $list ) . '</ul>';
@@ -137,7 +143,7 @@
138144 array( 'class' => 'wminc-infopage-status' ),
139145 wfMsgWikiHtml( 'wminc-infopage-missingwiki-text',
140146 $this->mProjectName, $this->mLangName )
141 - ) .
 147+ ) .
142148 Html::rawElement( 'ul', array( 'class' => 'wminc-infopage-options' ),
143149 Html::rawElement( 'li', null,
144150 wfMsgExt( $this->mIsSister ? 'wminc-infopage-option-startsister' : 'wminc-infopage-option-startwiki',
@@ -159,22 +165,22 @@
160166 * @return String
161167 */
162168 public function showIncubatingWiki() {
163 - global $wgUser, $wgLang;
 169+ global $wgLang;
164170 $substatus = $this->mSubStatus;
165171 if( $substatus == 'imported' && $this->mIsSister ) {
166172 $substatus = 'closedsister';
167173 }
168 - $portalLink = $wgUser->getSkin()->makeExternalLink( $this->mPortal, $this->mProjectName );
 174+ $portalLink = Linker::makeExternalLink( $this->mPortal, $this->mProjectName );
169175 if( $this->mThisLangData['type'] != 'invalid' ) {
170 - $gotoLink = $wgUser->getSkin()->link(
171 - Title::newFromText( IncubatorTest::getMainPage( $this->mLangCode, $this->mPrefix ) ),
 176+ $gotoLink = Linker::link(
 177+ IncubatorTest::getMainPage( $this->mLangCode, $this->mPrefix ),
172178 wfMsgNoTrans( 'wminc-infopage-enter' ) );
173179 $gotoMainPage = Html::rawElement( 'span',
174180 array( 'class' => 'wminc-infopage-entertest' ),
175181 $wgLang->getArrow() . ' ' . ( $this->mIsSister ? $portalLink : $gotoLink ) );
176182 }
177183 $subdomain = IncubatorTest::getSubdomain( $this->mLangCode, $this->mProjectCode );
178 - $subdomainLink = $wgUser->getSkin()->makeExternalLink( $subdomain, $subdomain );
 184+ $subdomainLink = IncubatorTest::makeExternalLinkText( $subdomain, true );
179185 $content = Html::rawElement( 'div', array( 'class' => 'wminc-infopage-status' ),
180186 wfMsgWikiHtml( 'wminc-infopage-status-' . $substatus, $subdomainLink, $portalLink ) );
181187 if( $this->mSubStatus != 'approved' && $this->mThisLangData['type'] != 'invalid' ) {
@@ -189,11 +195,11 @@
190196 * @return String
191197 */
192198 public function showExistingWiki() {
193 - global $wgLang, $wgUser;
 199+ global $wgLang;
194200 $created = isset( $this->mCreated ) ? $this->mCreated : ''; # for future use
195201 $bug = isset( $this->mBug ) ? $this->mBug : ''; # for future use
196202 $subdomain = IncubatorTest::getSubdomain( $this->mLangCode, $this->mProjectCode );
197 - $subdomainLink = $wgUser->getSkin()->makeExternalLink( $subdomain, $subdomain );
 203+ $subdomainLink = IncubatorTest::makeExternalLinkText( $subdomain, true );
198204 if( $this->mThisLangData['type'] != 'invalid' ) {
199205 $gotoSubdomain = Html::rawElement( 'span',
200206 array( 'class' => 'wminc-infopage-entertest' ),
@@ -210,4 +216,4 @@
211217 );
212218 return $this->StandardInfoPage( $this->showWelcome(), $gotoSubdomain, $content );
213219 }
214 -}
\ No newline at end of file
 220+}
Index: branches/wmf/1.18wmf1/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php
@@ -16,6 +16,7 @@
1717 'wminc-manual' => 'Manual',
1818 'wminc-listwikis' => 'List of wikis',
1919 'wminc-testwiki' => 'Test wiki:',
 20+ 'wminc-testwiki-code' => 'Test wiki language:',
2021 'wminc-testwiki-none' => 'None/All',
2122 'wminc-recentchanges-all' => 'All recent changes',
2223
@@ -45,15 +46,22 @@
4647 'wminc-ip' => '"$1" is an IP address.',
4748
4849 # User groups
49 - 'right-viewuserlang' => 'View [[Special:ViewUserLang|user language and test wiki]]',
 50+ 'right-viewuserlang' => 'View user language and test wiki',
5051 'group-test-sysop' => 'Test wiki administrators',
51 - 'group-test-sysop-member' => 'test wiki administrator',
 52+ 'group-test-sysop-member' => '{{GENDER:$1|test wiki administrator}}',
5253 'grouppage-test-sysop' => 'Project:Test wiki administrators',
5354
5455 # Language codes
5556 'wminc-code-macrolanguage' => 'The [[wikipedia:$2 language|"$3" language]] is a [[wikipedia:ISO 639 macrolanguage|macrolanguage]], consisting of the following member languages:',
5657 'wminc-code-collective' => 'The code "$1" does not refer to a specific language, but to a collection of languages, namely the [[wikipedia:$2 language|"$3" languages]].',
5758 'wminc-code-retired' => 'This language code has been changed and no longer refers to the original language.',
 59+
 60+ # Special:ListUsers
 61+ 'wminc-listusers-testwiki' => 'You are viewing users who have set their test wiki preference to $1.',
 62+
 63+ # Search
 64+ 'wminc-search-nocreate-nopref' => 'You searched for "$1". Please set your [[Special:Preferences|test wiki preference]] so we can tell you which page you can create!',
 65+ 'wminc-search-nocreate-suggest' => 'You searched for "$1". You can create a page in your wiki at <b>[[$2]]</b>!',
5866 );
5967
6068 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r105788MFT r103640 for DefaultSettings.php. Was already merged for WikimediaIncubato...siebrand10:14, 11 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95582Ability to filter list of users based on their test wiki preferencerobin23:24, 26 August 2011
r96122* Use more specific css for .subpages and mark it important, because it's ove...robin16:43, 2 September 2011
r96138* Call core function Language::getTranslatedLanguageName() if found, instead ...robin18:18, 2 September 2011
r96141Drop support for 1.17 and below, as version_compare() doesn't work properly a...robin19:20, 2 September 2011
r97175Re-do reverted r96824, but in SpecialSearch first return if the title object ...robin16:26, 15 September 2011
r98670* IncubatorTest::onGetUserPermissionsErrors(): do not disallow deleting pages...robin13:49, 2 October 2011
r98671Directly make a Title object in getMainPage(), much simpler..robin14:07, 2 October 2011
r99394Follow-up r99312: bug 31581: Allow gender distinction for user groups in exte...siebrand08:29, 10 October 2011
r102886Follow-up r102187: fixed two remaining hooks that were expecting 'read' to no...ialex09:16, 13 November 2011
r103637Apparently behaviour changed in trunk, so blacklisting actions instead of whi...robin04:17, 19 November 2011
r103640Make $wgDummyLanguageCodes an associative array so it maps to the correct cod...robin05:18, 19 November 2011
r103649Fix r103637robin08:38, 19 November 2011
r103822simplify code, 'createpage' requires 'edit' right anywayrobin16:54, 21 November 2011
r104906Titles per project, so the project names can be localized as well. Also use p...robin22:36, 1 December 2011
r104993Documentation...reedy19:41, 2 December 2011

Status & tagging log