summaryrefslogtreecommitdiff
path: root/includes/parser/ParserCache.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/parser/ParserCache.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/parser/ParserCache.php')
-rw-r--r--includes/parser/ParserCache.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index 0faa40a8..7053f134 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -67,7 +67,7 @@ class ParserCache {
// idhash seem to mean 'page id' + 'rendering hash' (r3710)
$pageid = $article->getID();
- $renderkey = (int)($wgRequest->getVal( 'action' ) == 'render');
+ $renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' );
$key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
return $key;
@@ -128,7 +128,7 @@ class ParserCache {
public function getKey( $article, $popts, $useOutdated = true ) {
global $wgCacheEpoch;
- if( $popts instanceof User ) {
+ if ( $popts instanceof User ) {
wfWarn( "Use of outdated prototype ParserCache::getKey( &\$article, &\$user )\n" );
$popts = ParserOptions::newFromUser( $popts );
}
@@ -223,19 +223,19 @@ class ParserCache {
* @param $parserOutput ParserOutput
* @param $article Article
* @param $popts ParserOptions
+ * @param $cacheTime Time when the cache was generated
*/
- public function save( $parserOutput, $article, $popts ) {
+ public function save( $parserOutput, $article, $popts, $cacheTime = null ) {
$expire = $parserOutput->getCacheExpiry();
-
- if( $expire > 0 ) {
- $now = wfTimestampNow();
+ if ( $expire > 0 ) {
+ $cacheTime = $cacheTime ?: wfTimestampNow();
$optionsKey = new CacheTime;
$optionsKey->mUsedOptions = $parserOutput->getUsedOptions();
$optionsKey->updateCacheExpiry( $expire );
- $optionsKey->setCacheTime( $now );
- $parserOutput->setCacheTime( $now );
+ $optionsKey->setCacheTime( $cacheTime );
+ $parserOutput->setCacheTime( $cacheTime );
$optionsKey->setContainsOldMagic( $parserOutput->containsOldMagic() );
@@ -245,8 +245,8 @@ class ParserCache {
// Save the timestamp so that we don't have to load the revision row on view
$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" );
+ $parserOutput->mText .= "\n<!-- Saved in parser cache with key $parserOutputKey and timestamp $cacheTime\n -->\n";
+ wfDebug( "Saved in parser cache with key $parserOutputKey and timestamp $cacheTime\n" );
// Save the parser output
$this->mMemc->set( $parserOutputKey, $parserOutput, $expire );