[Mediawiki-l] Hook called on cache miss?

Stephan Gambke s7eph4n at gmail.com
Wed Nov 9 22:35:25 UTC 2011


Hi,

I'm looking for a hook that is called when the text of an article is
parsed because of a cache miss.

On IRC I was told to use one of the hooks called by Parser::parse, but I
am not sure that's the solution:
* Parse is also called on cached pages, e.g. to render the 'This page
has been accessed xxx times.' message.
* There seems to be no elegant way to recognize if the text to parse is
the actual Article content.

Currently I hook into ParserBeforeTidy, use a static variable to ensure
the method is executed only once and create a Revision object to get at
the article text. The method is always run regardless of whether there
was a cache miss or not.

There should be an easier and more elegant way to do this, right?

Cheers,
Stephan



More information about the MediaWiki-l mailing list