From: Steve Sanbeg Date: Tue, 1 May 2007 22:42:41 +0000 (+0000) Subject: cleanup of my previous commit, per Tim. X-Git-Tag: 1.31.0-rc.0~53137 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=15fd78857ce05cea4719f94e75dfcd55a0d2bf11;p=lhc%2Fweb%2Fwiklou.git cleanup of my previous commit, per Tim. --- diff --git a/includes/Parser.php b/includes/Parser.php index 9004aea238..9d4967d40a 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3089,7 +3089,7 @@ class Parser $found = false; //access denied wfDebug( "$fname: template inclusion denied for " . $title->getPrefixedDBkey() ); } else { - $articleContent = $this->fetchTemplate( $title ); + list($articleContent,$title) = $this->fetchTemplateAndtitle( $title ); if ( $articleContent !== false ) { $found = true; $text = $articleContent; @@ -3266,8 +3266,9 @@ class Parser /** * Fetch the unparsed text of a template and register a reference to it. */ - function fetchTemplate( $title ) { + function fetchTemplateAndtitle( $title ) { $text = false; + $finalTitle = $title; // Loop to fetch the article, with up to 1 redirect for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { $rev = Revision::newFromTitle( $title ); @@ -3289,9 +3290,15 @@ class Parser break; } // Redirect? + $finalTitle = $title; $title = Title::newFromRedirect( $text ); } - return $text; + return array($text,$finalTitle); + } + + function fetchTemplate( $title ) { + $rv = $this->fetchTemplateAndtitle($title); + return $rv[0]; } /**