r21776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21775‎ | r21776 | r21777 >
Date:22:42, 1 May 2007
Author:sanbeg
Status:old
Tags:
Comment:
cleanup of my previous commit, per Tim.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3089,7 +3089,7 @@
30903090 $found = false; //access denied
30913091 wfDebug( "$fname: template inclusion denied for " . $title->getPrefixedDBkey() );
30923092 } else {
3093 - $articleContent = $this->fetchTemplate( $title );
 3093+ list($articleContent,$title) = $this->fetchTemplateAndtitle( $title );
30943094 if ( $articleContent !== false ) {
30953095 $found = true;
30963096 $text = $articleContent;
@@ -3266,8 +3266,9 @@
32673267 /**
32683268 * Fetch the unparsed text of a template and register a reference to it.
32693269 */
3270 - function fetchTemplate( $title ) {
 3270+ function fetchTemplateAndtitle( $title ) {
32713271 $text = false;
 3272+ $finalTitle = $title;
32723273 // Loop to fetch the article, with up to 1 redirect
32733274 for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) {
32743275 $rev = Revision::newFromTitle( $title );
@@ -3289,11 +3290,17 @@
32903291 break;
32913292 }
32923293 // Redirect?
 3294+ $finalTitle = $title;
32933295 $title = Title::newFromRedirect( $text );
32943296 }
3295 - return $text;
 3297+ return array($text,$finalTitle);
32963298 }
32973299
 3300+ function fetchTemplate( $title ) {
 3301+ $rv = $this->fetchTemplateAndtitle($title);
 3302+ return $rv[0];
 3303+ }
 3304+
32983305 /**
32993306 * Transclude an interwiki link.
33003307 */