diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/parser/ParserCache.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/parser/ParserCache.php')
-rw-r--r-- | includes/parser/ParserCache.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index dcbf7a4d..8b043290 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -15,6 +15,8 @@ class ParserCache { /** * Get an instance of this object + * + * @return ParserCache */ public static function singleton() { static $instance; @@ -78,7 +80,7 @@ class ParserCache { */ function getETag( $article, $popts ) { return 'W/"' . $this->getParserOutputKey( $article, - $popts->optionsHash( ParserOptions::legacyOptions() ) ) . + $popts->optionsHash( ParserOptions::legacyOptions(), $article->getTitle() ) ) . "--" . $article->getTouched() . '"'; } @@ -98,6 +100,8 @@ class ParserCache { * It would be preferable to have this code in get() * instead of having Article looking in our internals. * + * @todo Document parameter $useOutdated + * * @param $article Article * @param $popts ParserOptions */ @@ -128,7 +132,7 @@ class ParserCache { $usedOptions = ParserOptions::legacyOptions(); } - return $this->getParserOutputKey( $article, $popts->optionsHash( $usedOptions ) ); + return $this->getParserOutputKey( $article, $popts->optionsHash( $usedOptions, $article->getTitle() ) ); } /** @@ -156,6 +160,7 @@ class ParserCache { $parserOutputKey = $this->getKey( $article, $popts, $useOutdated ); if ( $parserOutputKey === false ) { + wfIncrStats( 'pcache_miss_absent' ); wfProfileOut( __METHOD__ ); return false; } @@ -163,18 +168,19 @@ class ParserCache { $value = $this->mMemc->get( $parserOutputKey ); if ( self::try116cache && !$value && strpos( $value, '*' ) !== -1 ) { wfDebug( "New format parser cache miss.\n" ); - $parserOutputKey = $this->getParserOutputKey( $article, $popts->optionsHash( ParserOptions::legacyOptions() ) ); + $parserOutputKey = $this->getParserOutputKey( $article, + $popts->optionsHash( ParserOptions::legacyOptions(), $article->getTitle() ) ); $value = $this->mMemc->get( $parserOutputKey ); } if ( !$value ) { - wfDebug( "Parser cache miss.\n" ); + wfDebug( "ParserOutput cache miss.\n" ); wfIncrStats( "pcache_miss_absent" ); wfProfileOut( __METHOD__ ); return false; } - wfDebug( "Found.\n" ); - + wfDebug( "ParserOutput cache found.\n" ); + // The edit section preference may not be the appropiate one in // the ParserOutput, as we are not storing it in the parsercache // key. Force it here. See bug 31445. @@ -197,7 +203,6 @@ class ParserCache { * @param $parserOutput ParserOutput * @param $article Article * @param $popts ParserOptions - * @return void */ public function save( $parserOutput, $article, $popts ) { $expire = $parserOutput->getCacheExpiry(); @@ -215,10 +220,10 @@ class ParserCache { $optionsKey->setContainsOldMagic( $parserOutput->containsOldMagic() ); $parserOutputKey = $this->getParserOutputKey( $article, - $popts->optionsHash( $optionsKey->mUsedOptions ) ); + $popts->optionsHash( $optionsKey->mUsedOptions, $article->getTitle() ) ); // Save the timestamp so that we don't have to load the revision row on view - $parserOutput->mTimestamp = $article->getTimestamp(); + $parserOutput->setTimestamp( $article->getTimestamp() ); $parserOutput->mText .= "\n<!-- Saved in parser cache with key $parserOutputKey and timestamp $now -->\n"; wfDebug( "Saved in parser cache with key $parserOutputKey and timestamp $now\n" ); |