r33381 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33380‎ | r33381 | r33382 >
Date:18:11, 15 April 2008
Author:brion
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -107,16 +107,11 @@
108108 /**
109109 * Get the Title object this page redirects to
110110 *
111 - * @param bool $getFragment should the fragment be set on the title
112111 * @return mixed false, Title of in-wiki target, or string with URL
113112 */
114 - function followRedirect( $getFragment = false ) {
115 - if( $getFragment )
116 - // We'll need to use the content of this page, as Article::getRedirectTarget()
117 - // now loads the data from redirect table, wich doesn't store the fragment
118 - $rt = Title::newFromRedirect( $this->getContent() );
119 - else
120 - $rt = $this->getRedirectTarget();
 113+ function followRedirect() {
 114+ $text = $this->getContent();
 115+ $rt = Title::newFromRedirect( $text );
121116
122117 # process if title object is valid and not special:userlogout
123118 if( $rt ) {
@@ -857,7 +852,7 @@
858853
859854 }
860855
861 - elseif ( $rt = $this->getRedirectTarget() ) {
 856+ elseif ( $rt = Title::newFromRedirect( $text ) ) {
862857 # Display redirect
863858 $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
864859 $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png';
Index: trunk/phase3/includes/Wiki.php
@@ -288,7 +288,7 @@
289289
290290 // Follow redirects only for... redirects
291291 if( $article->mIsRedirect ) {
292 - $target = $article->followRedirect( true /* getFragment */ );
 292+ $target = $article->followRedirect();
293293 if( is_string( $target ) ) {
294294 if( !$this->getVal( 'DisableHardRedirects' ) ) {
295295 // we'll need to redirect

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r33133Committing patch for bug 10931, which also fixes bug 13651. For a detailed ex...catrope15:20, 11 April 2008
r33375(bug 13752) Section redirects now works againialex17:32, 15 April 2008

Status & tagging log