[Mediawiki-l] User options and caching??

Daniel Barrett danb at VistaPrint.com
Wed Aug 3 02:14:37 UTC 2011


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:

static function myHookFunction($input, $args, $parser) {
    $parser->disableCache();
    global $wgEnableParserCache, $wgCachePages, $wgParser;
    $wgParser->disableCache();
    $wgEnableParserCache = false;
    $wgCachePages = false;
    ...
}

But all of this has no effect.  The only way to get the new data to appear is to edit the page or use ?action=purge.

Coincidentally, I have another extension that displays the same data (not using a parser tag, but an ordinary callback via $wgHooks['OutputPageBeforeHTML']), and the data is always up to date.

Both extensions use User::newFromName($username) to obtain User objects, and $user->getOption() to get the values. But I don't think the User class is causing this. When I make code changes to my parser tag, I don't even see the results of the changes until I edit the page or use ?action=purge.

We are not running any other external caches at the PHP or web level.

What am I missing?

Thanks,
DanB



More information about the MediaWiki-l mailing list