diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
commit | 72e90545454c0e014318fa3c81658e035aac58c1 (patch) | |
tree | 9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/parser/ParserCache.php | |
parent | 565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff) |
applying patch to version 1.15.0
Diffstat (limited to 'includes/parser/ParserCache.php')
-rw-r--r-- | includes/parser/ParserCache.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 7e61157a..d17214c3 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -26,8 +26,14 @@ class ParserCache { $this->mMemc =& $memCached; } - function getKey( &$article, &$user ) { - global $action; + function getKey( &$article, $popts ) { + global $wgRequest; + + if( $popts instanceof User ) // It used to be getKey( &$article, &$user ) + $popts = ParserOptions::newFromUser( $popts ); + + $user = $popts->mUser; + $printable = ( $popts->getIsPrintable() ) ? '!printable=1' : ''; $hash = $user->getPageRenderingHash(); if( !$article->mTitle->quickUserCan( 'edit' ) ) { // section edit links are suppressed even if the user has them on @@ -36,21 +42,21 @@ class ParserCache { $edit = ''; } $pageid = $article->getID(); - $renderkey = (int)($action == 'render'); - $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}{$edit}" ); + $renderkey = (int)($wgRequest->getVal('action') == 'render'); + $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}{$edit}{$printable}" ); return $key; } - function getETag( &$article, &$user ) { - return 'W/"' . $this->getKey($article, $user) . "--" . $article->mTouched. '"'; + function getETag( &$article, $popts ) { + return 'W/"' . $this->getKey($article, $popts) . "--" . $article->mTouched. '"'; } - function get( &$article, &$user ) { + function get( &$article, $popts ) { global $wgCacheEpoch; $fname = 'ParserCache::get'; wfProfileIn( $fname ); - $key = $this->getKey( $article, $user ); + $key = $this->getKey( $article, $popts ); wfDebug( "Trying parser cache $key\n" ); $value = $this->mMemc->get( $key ); @@ -86,9 +92,9 @@ class ParserCache { return $value; } - function save( $parserOutput, &$article, &$user ){ + function save( $parserOutput, &$article, $popts ){ global $wgParserCacheExpireTime; - $key = $this->getKey( $article, $user ); + $key = $this->getKey( $article, $popts ); if( $parserOutput->getCacheTime() != -1 ) { |