[Mediawiki-l] User options and caching??

Brion Vibber brion at wikimedia.org
Wed Aug 3 07:14:46 UTC 2011


On Wed, Aug 3, 2011 at 5:14 AM, Daniel Barrett <danb at vistaprint.com> wrote:

> I wrote a parser tag that displays some user options that are set in
> Special:Preference. It gets embedded in an article like this:
>
> <mystuff/>
>
> However, when users change their options, my parser tag appears still
> displays old, cached data. I have tried everything I can think of to stop
> this caching:
>

Here's the hook you want:

'PageRenderingHash': alter the parser cache option hash key
A parser extension which depends on user options should install
this hook and append its values to the key.
$hash: reference to a hash key string which can be modified

If working for the latest MW versions only, you can also stick a flag in the
parser output to indicate whether the feature was used, so it doesn't need
to be included in the hash when not set. I forget offhand exactly how to do
that, but you can look around at some of the parser internals if you dare.
;)

-- brion


More information about the MediaWiki-l mailing list