Revert some chunks of r33133 and r33375:
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Apr 2008 18:11:28 +0000 (18:11 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 15 Apr 2008 18:11:28 +0000 (18:11 +0000)
* 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
includes/Wiki.php

index 02c3cd6..7899d45 100644 (file)
@@ -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';
index 49aaec9..8ff137b 100644 (file)
@@ -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