Add reference to the current user to the PageRenderingHash hook

To generate a user-dependent cache key it makes sense to pass
a reference to the user object, since $wgUser is deprecated.

Change-Id: I32a1df52912292230852c31d69968eeb312a4a97
This commit is contained in:
physikerwelt 2014-01-03 17:05:24 +00:00 committed by Krinkle
parent 1e5e4d91e2
commit ce2b03fb0b
2 changed files with 3 additions and 2 deletions

View file

@ -1793,7 +1793,8 @@ $queryInfo: the query parameters
'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
&$confstr: reference to a hash key string which can be modified
$user: User (object) requesting the page
'ParserAfterParse': Called from Parser::parse() just after the call to
Parser::internalParse() returns.

View file

@ -571,7 +571,7 @@ class ParserOptions {
// Give a chance for extensions to modify the hash, if they have
// extra options or other effects on the parser cache.
wfRunHooks( 'PageRenderingHash', array( &$confstr ) );
wfRunHooks( 'PageRenderingHash', array( &$confstr, $this->getUser() ) );
// Make it a valid memcached key fragment
$confstr = str_replace( ' ', '_', $confstr );