[Mediawiki-l] Cloning the parser?

Juliano F. Ravasi ml at juliano.info
Thu Sep 9 03:30:24 UTC 2010


On 09-09-2010 00:08, Tim Starling wrote:
> Parser::clearState() should be enough to fix this (or calling some
> parser method that calls clearState()), and that's what
> MessageCache::transform() relies on when it clones the parser.
> Parser::clearState() has some special hacks in it to clean up after a
> clone.

This is good to know. I have a similar problem in Extension:Wikilog. It 
needs a separate parser to generate Atom/RSS feeds, which have several 
restrictions (all URLs must be absolute, TOCs must not be generated, etc.).

Currently, it has two options: either cloning $wgParser (the default) or 
creating a new Parser object. The problem with the second option is that 
there are way too many broken extensions that initialize $wgParser 
directly instead of the $parser parameter from the ParserFirstCallInit hook.

With this information now, I may consider settling with a $wgParser 
clone to satisfy these needs.

Regards,

-- 
Juliano F. Ravasi ·· http://juliano.info/
5105 46CC B2B7 F0CD 5F47 E740 72CA 54F4 DF37 9E96



More information about the MediaWiki-l mailing list