Index: trunk/phase3/includes/Parser.php |
— | — | @@ -3089,7 +3089,7 @@ |
3090 | 3090 | $found = false; //access denied |
3091 | 3091 | wfDebug( "$fname: template inclusion denied for " . $title->getPrefixedDBkey() ); |
3092 | 3092 | } else { |
3093 | | - $articleContent = $this->fetchTemplate( $title ); |
| 3093 | + list($articleContent,$title) = $this->fetchTemplateAndtitle( $title ); |
3094 | 3094 | if ( $articleContent !== false ) { |
3095 | 3095 | $found = true; |
3096 | 3096 | $text = $articleContent; |
— | — | @@ -3266,8 +3266,9 @@ |
3267 | 3267 | /** |
3268 | 3268 | * Fetch the unparsed text of a template and register a reference to it. |
3269 | 3269 | */ |
3270 | | - function fetchTemplate( $title ) { |
| 3270 | + function fetchTemplateAndtitle( $title ) { |
3271 | 3271 | $text = false; |
| 3272 | + $finalTitle = $title; |
3272 | 3273 | // Loop to fetch the article, with up to 1 redirect |
3273 | 3274 | for ( $i = 0; $i < 2 && is_object( $title ); $i++ ) { |
3274 | 3275 | $rev = Revision::newFromTitle( $title ); |
— | — | @@ -3289,11 +3290,17 @@ |
3290 | 3291 | break; |
3291 | 3292 | } |
3292 | 3293 | // Redirect? |
| 3294 | + $finalTitle = $title; |
3293 | 3295 | $title = Title::newFromRedirect( $text ); |
3294 | 3296 | } |
3295 | | - return $text; |
| 3297 | + return array($text,$finalTitle); |
3296 | 3298 | } |
3297 | 3299 | |
| 3300 | + function fetchTemplate( $title ) { |
| 3301 | + $rv = $this->fetchTemplateAndtitle($title); |
| 3302 | + return $rv[0]; |
| 3303 | + } |
| 3304 | + |
3298 | 3305 | /** |
3299 | 3306 | * Transclude an interwiki link. |
3300 | 3307 | */ |