X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FCacheTime.php;h=05bcebef64cd6e3a9da3761b3a2bb18abc9a9eed;hb=491da22a1e4bd9dd296adeb8a910172bac48c340;hp=e382cf3b819e7f7aaf0b3f6f83813463074997b4;hpb=13d083b2065092b4bc48288a8ecdee9270fdb19e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/CacheTime.php b/includes/parser/CacheTime.php index e382cf3b81..05bcebef64 100644 --- a/includes/parser/CacheTime.php +++ b/includes/parser/CacheTime.php @@ -32,11 +32,17 @@ class CacheTime { */ public $mUsedOptions; - public $mVersion = Parser::VERSION, # Compatibility check - $mCacheTime = '', # Time when this object was generated, or -1 for uncacheable. Used in ParserCache. - $mCacheExpiry = null, # Seconds after which the object should expire, use 0 for uncacheable. Used in ParserCache. - $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}} - $mCacheRevisionId = null; # Revision ID that was parsed + # Compatibility check + public $mVersion = Parser::VERSION; + + # Time when this object was generated, or -1 for uncacheable. Used in ParserCache. + public $mCacheTime = ''; + + # Seconds after which the object should expire, use 0 for uncacheable. Used in ParserCache. + public $mCacheExpiry = null; + + # Revision ID that was parsed + public $mCacheRevisionId = null; /** * @return string TS_MW timestamp @@ -45,25 +51,10 @@ class CacheTime { return wfTimestamp( TS_MW, $this->mCacheTime ); } - /** - * @return bool - */ - public function containsOldMagic() { - return $this->mContainsOldMagic; - } - - /** - * @param bool $com - * @return bool - */ - public function setContainsOldMagic( $com ) { - return wfSetVar( $this->mContainsOldMagic, $com ); - } - /** * setCacheTime() sets the timestamp expressing when the page has been rendered. * This does not control expiry, see updateCacheExpiry() for that! - * @param string $t + * @param string $t TS_MW timestamp * @return string */ public function setCacheTime( $t ) { @@ -88,12 +79,15 @@ class CacheTime { /** * Sets the number of seconds after which this object should expire. + * * This value is used with the ParserCache. * If called with a value greater than the value provided at any previous call, * the new call has no effect. The value returned by getCacheExpiry is smaller * or equal to the smallest number that was provided as an argument to * updateCacheExpiry(). * + * Avoid using 0 if at all possible. Consider JavaScript for highly dynamic content. + * * @param int $seconds */ public function updateCacheExpiry( $seconds ) { @@ -102,11 +96,6 @@ class CacheTime { if ( $this->mCacheExpiry === null || $this->mCacheExpiry > $seconds ) { $this->mCacheExpiry = $seconds; } - - // hack: set old-style marker for uncacheable entries. - if ( $this->mCacheExpiry !== null && $this->mCacheExpiry <= 0 ) { - $this->mCacheTime = -1; - } } /** @@ -133,10 +122,6 @@ class CacheTime { $expire = min( $expire, $wgParserCacheExpireTime ); } - if ( $this->containsOldMagic() ) { //compatibility hack - $expire = min( $expire, 3600 ); # 1 hour - } - if ( $expire <= 0 ) { return 0; // not cacheable } else {