From: Ilmari Karonen Date: Sun, 3 Dec 2006 00:22:14 +0000 (+0000) Subject: Use Title::newMainPage() in various places instead of calling X-Git-Tag: 1.31.0-rc.0~55005 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=e0b9a317ed88d07fa040acc38494624b0e2b8b6e;p=lhc%2Fweb%2Fwiklou.git Use Title::newMainPage() in various places instead of calling wfMsgForContent( 'mainpage' ) directly. Also add release notes for previous commit. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f464313a5c..d721871602 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -242,7 +242,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * {{REVISIONTIMESTAMP}} now uses site local timezone instead of user timezone to ensure consistent behavior * {{REVISIONTIMESTAMP}} and friends should now work on non-MySQL backends - +* Special:Contributions has been rewritten to inherit from QueryPage +* Special:Contributions/newbies now lists the user who made each edit == Languages updated == diff --git a/includes/Export.php b/includes/Export.php index c9878c97a0..b7e0f9a1d4 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -337,8 +337,7 @@ class XmlDumpWriter { } function homelink() { - $page = Title::newFromText( wfMsgForContent( 'mainpage' ) ); - return wfElement( 'base', array(), $page->getFullUrl() ); + return wfElement( 'base', array(), Title::newMainPage()->getFullUrl() ); } function caseSetting() { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 264b5675a6..7cfd108af7 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -837,7 +837,7 @@ class OutputPage { # Don't return to the main page if the user can't read it # otherwise we'll end up in a pointless loop - $mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) ); + $mainPage = Title::newMainPage(); if( $mainPage->userCanRead() ) $this->returnToMain( true, $mainPage ); } @@ -974,7 +974,7 @@ class OutputPage { } if ( '' === $returnto ) { - $returnto = wfMsgForContent( 'mainpage' ); + $returnto = Title::newMainPage(); } if ( is_object( $returnto ) ) { diff --git a/includes/Skin.php b/includes/Skin.php index 924deef726..3e59e5e5cd 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1127,12 +1127,8 @@ END; else { $a = ''; } $mp = wfMsg( 'mainpage' ); - $titleObj = Title::newFromText( $mp ); - if ( is_object( $titleObj ) ) { - $url = $titleObj->escapeLocalURL(); - } else { - $url = ''; - } + $mptitle = Title::newMainPage(); + $url = ( is_object($mptitle) ? $mptitle->escapeLocalURL() : '' ); $logourl = $this->getLogo(); $s = ""; @@ -1170,9 +1166,7 @@ END; } function mainPageLink() { - $mp = wfMsgForContent( 'mainpage' ); - $mptxt = wfMsg( 'mainpage'); - $s = $this->makeKnownLink( $mp, $mptxt ); + $s = $this->makeKnownLinkObj( Title::newMainPage(), wfMsg( 'mainpage' ) ); return $s; } @@ -1495,6 +1489,12 @@ END; } /* these are used extensively in SkinTemplate, but also some other places */ + static function makeMainPageUrl( $urlaction = '' ) { + $title = Title::newMainPage(); + self::checkTitle( $title, $name ); + return $title->getLocalURL( $urlaction ); + } + static function makeSpecialUrl( $name, $urlaction = '' ) { $title = SpecialPage::getTitleFor( $name ); return $title->getLocalURL( $urlaction ); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index ca3546d1f5..7fe61fd549 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -810,7 +810,7 @@ class SkinTemplate extends Skin { $oldid = $wgRequest->getVal( 'oldid' ); $nav_urls = array(); - $nav_urls['mainpage'] = array( 'href' => self::makeI18nUrl( 'mainpage') ); + $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() ); if( $wgEnableUploads ) { if ($wgUploadNavigationUrl) { $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl ); diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php index aa77f2d375..2cd31eb57b 100644 --- a/includes/SpecialRandompage.php +++ b/includes/SpecialRandompage.php @@ -49,7 +49,7 @@ function wfSpecialRandompage( $par = NS_MAIN ) { } if( is_null( $title ) ) { # That's not supposed to happen :) - $title = Title::newFromText( wfMsg( 'mainpage' ) ); + $title = Title::newMainPage(); } $wgOut->reportTime(); # for logfile $wgOut->redirect( $title->getFullUrl() ); diff --git a/includes/SpecialRandomredirect.php b/includes/SpecialRandomredirect.php index 512553c02b..2cb2498b1e 100644 --- a/includes/SpecialRandomredirect.php +++ b/includes/SpecialRandomredirect.php @@ -45,7 +45,7 @@ function wfSpecialRandomredirect( $par = NULL ) { # Catch dud titles and return to the main page if( is_null( $title ) ) - $title = Title::newFromText( wfMsg( 'mainpage' ) ); + $title = Title::newMainPage(); $wgOut->reportTime(); $wgOut->redirect( $title->getFullUrl( 'redirect=no' ) ); diff --git a/includes/Wiki.php b/includes/Wiki.php index ea89eef4f8..1eec5f01d3 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -71,7 +71,7 @@ class MediaWiki { if ( '' == $title && 'delete' != $action ) { - $ret = Title::newFromText( wfMsgForContent( 'mainpage' ) ); + $ret = Title::newMainPage(); } elseif ( $curid = $request->getInt( 'curid' ) ) { # URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 8450cdec11..6862274a56 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -84,7 +84,7 @@ class SkinCologneBlue extends Skin { $s .= ""; $s .= $this->bottomLinks(); - $s .= "\n
" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | " + $s .= "\n
" . $this->makeKnownLinkObj( Title::newMainPage() ) . " | " . $this->aboutLink() . " | " . $this->searchForm( wfMsg( "qbfind" ) ); @@ -138,7 +138,7 @@ class SkinCologneBlue extends Skin { } $s = "" . - $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) ) + $this->mainPageLink() . " | " . $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) ) . " | " . diff --git a/skins/disabled/MonoBookCBT.php b/skins/disabled/MonoBookCBT.php index f5f742d601..3d145b24ad 100644 --- a/skins/disabled/MonoBookCBT.php +++ b/skins/disabled/MonoBookCBT.php @@ -764,7 +764,7 @@ class SkinMonoBookCBT extends SkinTemplate { } function logopath() { return $GLOBALS['wgLogo']; } - function mainpage() { return self::makeI18nUrl( 'mainpage' ); } + function mainpage() { return self::makeMainPageUrl(); } function sidebar( $startSection, $endSection, $innerTpl ) { $s = '';