From: Happy-melon Date: Thu, 25 Aug 2011 21:03:52 +0000 (+0000) Subject: Undo r85392 ('revert' is a strong word since a lot has changed in the intervening... X-Git-Tag: 1.31.0-rc.0~28061 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=d00052ebded6e5b44f1c7a08b977753eb0138afc;p=lhc%2Fweb%2Fwiklou.git Undo r85392 ('revert' is a strong word since a lot has changed in the intervening ten thousand revisions, but the effect is the same). --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 62da731aef..96432bef98 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -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', diff --git a/includes/Title.php b/includes/Title.php index f2099950f2..49feeef90d 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 diff --git a/includes/Wiki.php b/includes/Wiki.php index 71a79529ca..3cdbf3ef3c 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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' ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 82022cb362..f33c915c55 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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' ),