From: Tim Starling Date: Sun, 30 May 2004 07:31:26 +0000 (+0000) Subject: Fixed $wgCacheEpoch handling X-Git-Tag: 1.5.0alpha1~3140 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=3d1698b760b78f3152a7a22df30c9284eb3d7017;p=lhc%2Fweb%2Fwiklou.git Fixed $wgCacheEpoch handling --- diff --git a/includes/Parser.php b/includes/Parser.php index 5da9c974a3..ebddd60c24 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2001,7 +2001,7 @@ class Parser class ParserOutput { var $mText, $mLanguageLinks, $mCategoryLinks, $mContainsOldMagic; - var $mTouched; # Used for caching + var $mCacheTime; # Used in ParserCache function ParserOutput( $text = "", $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = false ) @@ -2010,19 +2010,19 @@ class ParserOutput $this->mLanguageLinks = $languageLinks; $this->mCategoryLinks = $categoryLinks; $this->mContainsOldMagic = $containsOldMagic; - $this->mTouched = ""; + $this->mCacheTime = ""; } function getText() { return $this->mText; } function getLanguageLinks() { return $this->mLanguageLinks; } function getCategoryLinks() { return $this->mCategoryLinks; } - function getTouched() { return $this->mTouched; } + function getCacheTime() { return $this->mCacheTime; } function containsOldMagic() { return $this->mContainsOldMagic; } function setText( $text ) { return wfSetVar( $this->mText, $text ); } function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); } function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategoryLinks, $cl ); } function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); } - function setTouched( $t ) { return wfSetVar( $this->mTouched, $t ); } + function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); } function merge( $other ) { $this->mLanguageLinks = array_merge( $this->mLanguageLinks, $other->mLanguageLinks ); diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 468fdc1eab..8066e4f57e 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -22,7 +22,7 @@ class ParserCache if ( $value ) { # Delete if article has changed since the cache was made $touched = $article->getTouched(); - if ( $value->getTouched() != $touched || $touched > $wgCacheEpoch ) { + if ( $value->getCacheTime() <= $touched || $value->getCacheTime < $wgCacheEpoch ) { $wgMemc->delete( $key ); $value = false; } @@ -37,19 +37,18 @@ class ParserCache function save( $parserOutput, &$article, &$user ){ global $wgMemc; $key = $this->getKey( $article, $user ); - $touched = $article->getTouched(); - $parserOutput->setTouched( $touched ); - $parserOutput->mText .= "\n\n"; + $now = wfTimestampNow(); + $parserOutput->setCacheTime( $now ); + $parserOutput->mText .= "\n\n"; if( $parserOutput->containsOldMagic() ){ $expire = 3600; # 1 hour } else { - $expire = 7*86400; # 7 days + $expire = 86400; # 1 day } $wgMemc->set( $key, $parserOutput, $expire ); } - }