Add an extra option for extensions adding an extra key directly instead of the hook or $wgRenderHashAppend, so that they can be added only to some instances.
This commit is contained in:
parent
b1aee940fa
commit
3f7fcd51a5
1 changed files with 11 additions and 0 deletions
|
|
@ -38,6 +38,7 @@ class ParserOptions {
|
|||
var $mIsSectionPreview; # Parsing the page for a "preview" operation on a single section
|
||||
var $mIsPrintable; # Parsing the printable version of the page
|
||||
|
||||
var $mExtraKey = ''; # Extra key that should be present in the caching key.
|
||||
|
||||
protected $accessedOptions;
|
||||
|
||||
|
|
@ -133,6 +134,13 @@ class ParserOptions {
|
|||
function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
|
||||
function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); }
|
||||
|
||||
/**
|
||||
* Extra key that should be present in the parser cache key.
|
||||
*/
|
||||
function addExtraKey( $key ) {
|
||||
$this->mExtraKey .= '!' . $key;
|
||||
}
|
||||
|
||||
function __construct( $user = null ) {
|
||||
$this->initialiseFromUser( $user );
|
||||
}
|
||||
|
|
@ -299,6 +307,9 @@ class ParserOptions {
|
|||
if ( $this->mIsPrintable && in_array( 'printable', $forOptions ) )
|
||||
$confstr .= '!printable=1';
|
||||
|
||||
if ( $this->mExtraKey != '' )
|
||||
$confstr .= $this->mExtraKey;
|
||||
|
||||
// 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 ) );
|
||||
|
|
|
|||
Loading…
Reference in a new issue