Use Title::newMainPage() in various places instead of calling
authorIlmari Karonen <vyznev@users.mediawiki.org>
Sun, 3 Dec 2006 00:22:14 +0000 (00:22 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Sun, 3 Dec 2006 00:22:14 +0000 (00:22 +0000)
wfMsgForContent( 'mainpage' ) directly.  Also add release notes
for previous commit.

RELEASE-NOTES
includes/Export.php
includes/OutputPage.php
includes/Skin.php
includes/SkinTemplate.php
includes/SpecialRandompage.php
includes/SpecialRandomredirect.php
includes/Wiki.php
skins/CologneBlue.php
skins/disabled/MonoBookCBT.php

index f464313..d721871 100644 (file)
@@ -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 ==
 
index c9878c9..b7e0f9a 100644 (file)
@@ -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() {
index 264b567..7cfd108 100644 (file)
@@ -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 ) ) {
index 924deef..3e59e5e 100644 (file)
@@ -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 = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
@@ -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 );
index ca3546d..7fe61fd 100644 (file)
@@ -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 );
index aa77f2d..2cd31eb 100644 (file)
@@ -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() );
index 512553c..2cb2498 100644 (file)
@@ -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' ) );
index ea89eef..1eec5f0 100644 (file)
@@ -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 );
index 8450cde..6862274 100644 (file)
@@ -84,7 +84,7 @@ class SkinCologneBlue extends Skin {
                $s .= "<td class='bottom' align='center' valign='top'>";
 
                $s .= $this->bottomLinks();
-               $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
+               $s .= "\n<br />" . $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" ) )
                  . " | " .
index f5f742d..3d145b2 100644 (file)
@@ -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 = '';