From ea8b2965a8927422d172c0ddb79e529c7720c8f0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 15 Apr 2008 18:11:28 +0000 Subject: [PATCH] Revert some chunks of r33133 and r33375: * Let followRedirect() *always* work correctly by working from the article text. * This ensures that we're not falsely looking up data from another version and that we're not missing interwik and fragment data. Should clean up both bug 13754 (editing old version of redirect sometimes gives the target page text) and bug 13752 (bugs with fragments and probably interwikis in redirect target). Haven't been able to repro 13754 at home though, so we'll see. --- includes/Article.php | 13 ++++--------- includes/Wiki.php | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 02c3cd610f..7899d452c6 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -107,16 +107,11 @@ class Article { /** * Get the Title object this page redirects to * - * @param bool $getFragment should the fragment be set on the title * @return mixed false, Title of in-wiki target, or string with URL */ - function followRedirect( $getFragment = false ) { - if( $getFragment ) - // We'll need to use the content of this page, as Article::getRedirectTarget() - // now loads the data from redirect table, wich doesn't store the fragment - $rt = Title::newFromRedirect( $this->getContent() ); - else - $rt = $this->getRedirectTarget(); + function followRedirect() { + $text = $this->getContent(); + $rt = Title::newFromRedirect( $text ); # process if title object is valid and not special:userlogout if( $rt ) { @@ -857,7 +852,7 @@ class Article { } - elseif ( $rt = $this->getRedirectTarget() ) { + elseif ( $rt = Title::newFromRedirect( $text ) ) { # Display redirect $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png'; diff --git a/includes/Wiki.php b/includes/Wiki.php index 49aaec9637..8ff137bdc4 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -288,7 +288,7 @@ class MediaWiki { // Follow redirects only for... redirects if( $article->mIsRedirect ) { - $target = $article->followRedirect( true /* getFragment */ ); + $target = $article->followRedirect(); if( is_string( $target ) ) { if( !$this->getVal( 'DisableHardRedirects' ) ) { // we'll need to redirect -- 2.20.1