r19892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19891‎ | r19892 | r19893 >
Date:10:24, 12 February 2007
Author:tstarling
Status:old
Tags:
Comment:
Register a link on #ifexist. Otherwise this breaks cache coherency.
Modified paths:
  • /trunk/extensions/ParserFunctions/ParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserFunctions/ParserFunctions.php
@@ -172,7 +172,14 @@
173173
174174 function ifexist( &$parser, $title = '', $then = '', $else = '' ) {
175175 $title = Title::newFromText( $title );
176 - return is_object( $title ) && $title->exists() ? $then : $else;
 176+ if ( $title ) {
 177+ $id = $title->getArticleID();
 178+ $parser->mOutput->addLink( $title, $id );
 179+ if ( $id ) {
 180+ return $then;
 181+ }
 182+ }
 183+ return $else;
177184 }
178185
179186 function time( &$parser, $format = '', $date = '' ) {