r98671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98670‎ | r98671 | r98672 >
Date:14:07, 2 October 2011
Author:robin
Status:ok
Tags:
Comment:
Directly make a Title object in getMainPage(), much simpler..
Modified paths:
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/InfoPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -574,12 +574,15 @@
575575
576576 /**
577577 * make "Wx/xxx/Main Page"
578 - * @return String
 578+ * @param $langCode String: The language code
 579+ * @param $prefix Null|String: the "Wx/xxx" prefix to add
 580+ * @return Title
579581 */
580582 public static function getMainPage( $langCode, $prefix = null ) {
581583 # Take the "mainpage" msg in the given language
582584 $msg = wfMsgExt( 'mainpage', array( 'language' => $langCode ) );
583 - return $prefix !== null ? $prefix . '/' . $msg : $msg;
 585+ $mainpage = $prefix !== null ? $prefix . '/' . $msg : $msg;
 586+ return Title::newFromText( $mainpage );
584587 }
585588
586589 /**
@@ -607,9 +610,7 @@
608611 # pass through the &uselang parameter
609612 $params['uselang'] = $uselang;
610613 }
611 - $mainpage = Title::newFromText(
612 - self::getMainPage( $prefix['lang'], $prefix['prefix'] )
613 - );
 614+ $mainpage = self::getMainPage( $prefix['lang'], $prefix['prefix'] );
614615 if( $mainpage->exists() ) {
615616 # Only redirect to the main page if that page exists
616617 $wgOut->redirect( $mainpage->getFullURL( $params ) );
Index: trunk/extensions/WikimediaIncubator/InfoPage.php
@@ -166,7 +166,7 @@
167167 $portalLink = Linker::makeExternalLink( $this->mPortal, $this->mProjectName );
168168 if( $this->mThisLangData['type'] != 'invalid' ) {
169169 $gotoLink = Linker::link(
170 - Title::newFromText( IncubatorTest::getMainPage( $this->mLangCode, $this->mPrefix ) ),
 170+ IncubatorTest::getMainPage( $this->mLangCode, $this->mPrefix ),
171171 wfMsgNoTrans( 'wminc-infopage-enter' ) );
172172 $gotoMainPage = Html::rawElement( 'span',
173173 array( 'class' => 'wminc-infopage-entertest' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r105776MFT for WikimediaIncubator: r95582, r96122, r96138, r96141, r97175, r98670, r...siebrand00:32, 11 December 2011

Status & tagging log