From: Brion Vibber Date: Sat, 14 Jan 2006 20:27:47 +0000 (+0000) Subject: revert more of dammit's broken code X-Git-Tag: 1.6.0~545 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=53539af7557ffed201acdc87a962c24e9e3e2e91;p=lhc%2Fweb%2Fwiklou.git revert more of dammit's broken code PLEASE TEST THIS FOR GOD'S SAKE --- diff --git a/includes/Article.php b/includes/Article.php index 555f5bbec7..9f1d3b8fab 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -91,8 +91,11 @@ class Article { } else { return $rt->getFullURL(); } - } - return $rt; + } elseif( $rt->exists() ) { + // Internal redirects can be handled relatively gracefully. + // We may have to change to another Article subclass, though. + return $rt; + } } } @@ -424,7 +427,6 @@ class Article { * @access private */ function loadPageData( $data ) { - $this->mTitle->mArticleID = $data->page_id; $this->mTitle->loadRestrictions( $data->page_restrictions ); $this->mTitle->mRestrictionsLoaded = true; diff --git a/includes/Wiki.php b/includes/Wiki.php index 7c359b0eef..996a5cf832 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -195,7 +195,6 @@ class MediaWiki { * @return mixed an Article, or a string to redirect to another URL */ function initializeArticle( $title, $request ) { - global $wgTitle; wfProfileIn( 'MediaWiki::initializeArticle' ); $action = $this->getVal('Action'); @@ -203,33 +202,21 @@ class MediaWiki { // Namespace might change when using redirects if( $action == 'view' && !$request->getVal( 'oldid' ) && $request->getVal( 'redirect' ) != 'no' ) { - $dbr=&wfGetDB(DB_SLAVE); - $article->loadPageData($article->pageDataFromTitle($dbr,$title)); - /* Follow redirects only for... redirects */ - if ($article->mIsRedirect) { - $target = $article->followRedirect(); - if( is_string( $target ) ) { - global $wgDisableHardRedirects; - if( !$wgDisableHardRedirects ) { - // we'll need to redirect - return $target; - } + $target = $article->followRedirect(); + if( is_string( $target ) ) { + global $wgDisableHardRedirects; + if( !$wgDisableHardRedirects ) { + // we'll need to redirect + return $target; } - if( is_object( $target ) ) { - // evil globals hack! - /* Rewrite environment to redirected article */ - $rarticle =& new Article($target); - $rarticle->loadPageData($rarticle->pageDataFromTitle($dbr,$target)); - if ($rarticle->mTitle->mArticleID) { - $article =& $rarticle; - $wgTitle = $target; - $article->setRedirectedFrom( $title ); - } else { - $wgTitle = $title; - } - } - } else { - $wgTitle = $article->mTitle; + } + if( is_object( $target ) ) { + // evil globals hack! + global $wgTitle; + $wgTitle = $target; + + $article = $this->articleFromTitle( $target ); + $article->setRedirectedFrom( $title ); } } wfProfileOut( 'MediaWiki::initializeArticle' ); @@ -376,4 +363,4 @@ class MediaWiki { }; /* End of class MediaWiki */ -?> +?> \ No newline at end of file