Undo r85392 ('revert' is a strong word since a lot has changed in the intervening...
authorHappy-melon <happy-melon@users.mediawiki.org>
Thu, 25 Aug 2011 21:03:52 +0000 (21:03 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Thu, 25 Aug 2011 21:03:52 +0000 (21:03 +0000)
includes/AutoLoader.php
includes/Title.php
includes/Wiki.php
languages/messages/MessagesEn.php

index 62da731..96432be 100644 (file)
@@ -24,7 +24,6 @@ $wgAutoloadLocalClasses = array(
        'AuthPluginUser' => 'includes/AuthPlugin.php',
        'Autopromote' => 'includes/Autopromote.php',
        'BacklinkCache' => 'includes/BacklinkCache.php',
-       'BadTitle' => 'includes/Title.php',
        'BaseTemplate' => 'includes/SkinTemplate.php',
        'Block' => 'includes/Block.php',
        'Category' => 'includes/Category.php',
index f209995..49feeef 100644 (file)
@@ -4369,38 +4369,4 @@ class Title {
                wfRunHooks( 'PageContentLanguage', array( $this, &$pageLang, $wgLang ) );
                return wfGetLangObj( $pageLang );
        }
-}
-
-/**
- * A BadTitle is generated in MediaWiki::parseTitle() if the title is invalid; the
- * software uses this to display an error page.  Internally it's basically a Title
- * for an empty special page
- */
-class BadTitle extends Title {
-       public function __construct(){
-               $this->mTextform = '';
-               $this->mUrlform = '';
-               $this->mDbkeyform = '';
-               $this->mNamespace = NS_SPECIAL; // Stops talk page link, etc, being shown
-       }
-
-       public function exists(){
-               return false;
-       }
-
-       public function getPrefixedText(){
-               return '';
-       }
-
-       public function getText(){
-               return '';
-       }
-
-       public function getPrefixedURL(){
-               return '';
-       }
-
-       public function getPrefixedDBKey(){
-               return '';
-       }
-}
+}
\ No newline at end of file
index 71a7952..3cdbf3e 100644 (file)
@@ -99,7 +99,7 @@ class MediaWiki {
                }
 
                if ( $ret === null || ( $ret->getDBkey() == '' && $ret->getInterwiki() == '' ) ) {
-                       $ret = new BadTitle;
+                       $ret = SpecialPage::getTitleFor( 'Badtitle' );
                }
 
                return $ret;
@@ -147,7 +147,9 @@ class MediaWiki {
                        array( &$title, null, &$output, &$user, $request, $this ) );
 
                // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
-               if ( $title instanceof BadTitle ) {
+               if ( is_null( $title ) || ( ( $title->getDBkey() == '' ) && ( $title->getInterwiki() == '' ) ) ) {
+                       $this->context->title = SpecialPage::getTitleFor( 'Badtitle' );
+                       // Die now before we mess up $wgArticle and the skin stops working
                        throw new ErrorPageError( 'badtitle', 'badtitletext' );
                // If the user is not logged in, the Namespace:title of the article must be in
                // the Read array in order for the user to see it. (We have to check here to
@@ -171,7 +173,7 @@ class MediaWiki {
                                // 301 so google et al report the target as the actual url.
                                $output->redirect( $url, 301 );
                        } else {
-                               $this->context->setTitle( new BadTitle );
+                               $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
                                wfProfileOut( __METHOD__ );
                                throw new ErrorPageError( 'badtitle', 'badtitletext' );
                        }
index 82022cb..f33c915 100644 (file)
@@ -365,6 +365,7 @@ $specialPageAliases = array(
        'Allmessages'               => array( 'AllMessages' ),
        'Allpages'                  => array( 'AllPages' ),
        'Ancientpages'              => array( 'AncientPages' ),
+       'Badtitle'                  => array( 'Badtitle' ),
        'Blankpage'                 => array( 'BlankPage' ),
        'Block'                     => array( 'Block', 'BlockIP', 'BlockUser' ),
        'Blockme'                   => array( 'BlockMe' ),