r97084 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97083‎ | r97084 | r97085 >
Date:18:48, 14 September 2011
Author:bawolff
Status:ok
Tags:
Comment:
(bug 29245) - Babel extension calls $wgParser recursively when auto creating categories (causing the usual problems).

This fix is inelegant, but I can't think of a better one. In any case better than the alternative of not fixing it
Modified paths:
  • /trunk/extensions/Babel/BabelAutoCreate.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/BabelAutoCreate.class.php
@@ -45,6 +45,16 @@
4646 return;
4747 }
4848
 49+
 50+ /* $article->doEdit will call $wgParser->parse.
 51+ * Calling Parser::parse recursively is baaaadd... (bug 29245)
 52+ * @todo FIXME: surely there is a better way?
 53+ */
 54+ global $wgParser, $wgParserConf;
 55+ $oldParser = $wgParser;
 56+ $parserClass = $wgParserConf['class'];
 57+ $wgParser = new $parserClass( $wgParserConf );
 58+
4959 $article->doEdit(
5060 $text,
5161 wfMsgForContent( 'babel-autocreate-reason', wfMsgForContent( 'babel-url' ) ),
@@ -52,6 +62,8 @@
5363 false,
5464 $user
5565 );
 66+
 67+ $wgParser = $oldParser;
5668 }
5769
5870 /**

Status & tagging log