r111840 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111839‎ | r111840 | r111841 >
Date:19:33, 18 February 2012
Author:robin
Status:ok
Tags:i18nreview 
Comment:
Remove own getLanguageNames function (no longer needed). Fix broken action 'create' and instead check 'edit' and title->exists().
Other minor things (simplify a bit of code, use https for extension link, link -> linkKnown).
Modified paths:
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/InfoPage.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/WikimediaIncubator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
@@ -17,7 +17,7 @@
1818 'name' => 'Wikimedia Incubator',
1919 'author' => 'SPQRobin',
2020 'version' => '4.8',
21 - 'url' => '//www.mediawiki.org/wiki/Extension:WikimediaIncubator',
 21+ 'url' => 'https://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
2222 'descriptionmsg' => 'wminc-desc',
2323 );
2424
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -67,9 +67,8 @@
6868 !$input ) {
6969 return Xml::element( 'span', array( 'class' => 'error' ),
7070 wfMessage( 'wminc-prefinfo-error' )->plain() );
71 - } else {
72 - return true;
7371 }
 72+ return true;
7473 }
7574
7675 /**
@@ -269,11 +268,8 @@
270269 }
271270
272271 static function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret ) {
273 - if( !self::displayPrefix() ) {
274 - $ret = 'none';
275 - } else {
276 - $ret = self::displayPrefix();
277 - }
 272+ $p = self::displayPrefix();
 273+ $ret = $p ? $p : 'none';
278274 return true;
279275 }
280276
@@ -331,7 +327,7 @@
332328 return $action != 'edit';
333329 }
334330
335 - if( !self::shouldWeShowUnprefixedError( $title ) || $action != 'create' ) {
 331+ if( !self::shouldWeShowUnprefixedError( $title ) || $action != 'edit' || $title->exists() ) {
336332 # only check if needed & if on page creation
337333 return true;
338334 } elseif( $prefixdata['error'] == 'invalidlangcode' ) {
@@ -374,7 +370,7 @@
375371 global $wgUser;
376372 if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
377373 $user = $nt->getText();
378 - $links[] = Linker::link(
 374+ $links[] = Linker::linkKnown(
379375 SpecialPage::getTitleFor( 'ViewUserLang', $user ),
380376 wfMessage( 'wminc-viewuserlang' )->escaped()
381377 );
@@ -383,16 +379,6 @@
384380 }
385381
386382 /**
387 - * This loads language names. Also from CLDR if that extension is found.
388 - * @return Array with language names
389 - */
390 - static public function getLanguageNames( $code = null ) {
391 - global $wgLang;
392 - $langcode = ( $code ? $code : $wgLang->getCode() );
393 - return Language::getTranslatedLanguageNames( $langcode );
394 - }
395 -
396 - /**
397383 * Do we know the databases of the existing wikis?
398384 * @return Boolean
399385 */
Index: trunk/extensions/WikimediaIncubator/InfoPage.php
@@ -25,7 +25,7 @@
2626 * @param $prefixdata
2727 */
2828 public function __construct( $title, $prefixdata ) {
29 - global $wmincProjects, $wmincSisterProjects;
 29+ global $wmincProjects, $wmincSisterProjects, $wgLang;
3030 $this->mTitle = $title;
3131 $this->mPrefix = $prefixdata['prefix'];
3232 $this->mLangCode = $prefixdata['lang'];
@@ -41,7 +41,7 @@
4242 $this->mDBStatus = '';
4343 $this->mSubStatus = '';
4444 $this->mThisLangData = array( 'type' => 'valid' ); # For later code check feature
45 - $this->mLangNames = IncubatorTest::getLanguageNames();
 45+ $this->mLangNames = Language::getTranslatedLanguageNames( $wgLang->getCode() );
4646 $this->mLangName = isset( $this->mLangNames[$this->mLangCode] ) ?
4747 $this->mLangNames[$this->mLangCode] : null;
4848 $titleParam = $this->mLangName ? $this->mLangName : '"' . $this->mLangCode . '"'; # Name, else code

Status & tagging log