Add reference to the current user to the PageRenderingHash hook
authorphysikerwelt <wiki@physikerwelt.de>
Fri, 3 Jan 2014 17:05:24 +0000 (17:05 +0000)
committerKrinkle <krinklemail@gmail.com>
Mon, 6 Jan 2014 15:04:54 +0000 (15:04 +0000)
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

docs/hooks.txt
includes/parser/ParserOptions.php

index fc4d40e..fd434d4 100644 (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.
index 8393216..c4e9a1c 100644 (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 );