From: Platonides Date: Tue, 10 Aug 2010 14:38:14 +0000 (+0000) Subject: Add an extra option for extensions adding an extra key directly instead of the hook... X-Git-Tag: 1.31.0-rc.0~35563 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=3f7fcd51a59aa6c15f137d27ce842b00c5956c52;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 72e4242d7a..bdff54c26d 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -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 ) );