dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "resourceloader: Simplify makeLoaderStateScript and makeLoaderSourcesScript"
[lhc/web/wiklou.git]
/
includes
/
parser
/
CacheTime.php
diff --git
a/includes/parser/CacheTime.php
b/includes/parser/CacheTime.php
index
26d5bdd
..
e9840a4
100644
(file)
--- a/
includes/parser/CacheTime.php
+++ b/
includes/parser/CacheTime.php
@@
-38,13
+38,13
@@
class CacheTime {
public $mVersion = Parser::VERSION;
/**
public $mVersion = Parser::VERSION;
/**
- * @var string|int TS_MW timestamp when this object was generated, or -1 for
un
cacheable. Used
+ * @var string|int TS_MW timestamp when this object was generated, or -1 for
not
cacheable. Used
* in ParserCache.
*/
public $mCacheTime = '';
/**
* in ParserCache.
*/
public $mCacheTime = '';
/**
- * @var int|null Seconds after which the object should expire, use 0 for
un
cacheable. Used in
+ * @var int|null Seconds after which the object should expire, use 0 for
not
cacheable. Used in
* ParserCache.
*/
public $mCacheExpiry = null;
* ParserCache.
*/
public $mCacheExpiry = null;
@@
-58,7
+58,11
@@
class CacheTime {
* @return string TS_MW timestamp
*/
public function getCacheTime() {
* @return string TS_MW timestamp
*/
public function getCacheTime() {
- return wfTimestamp( TS_MW, $this->mCacheTime );
+ // NOTE: keep support for undocumented used of -1 to mean "not cacheable".
+ if ( $this->mCacheTime === '' ) {
+ $this->mCacheTime = MWTimestamp::now();
+ }
+ return $this->mCacheTime;
}
/**
}
/**
@@
-68,6
+72,11
@@
class CacheTime {
* @return string
*/
public function setCacheTime( $t ) {
* @return string
*/
public function setCacheTime( $t ) {
+ // NOTE: keep support for undocumented used of -1 to mean "not cacheable".
+ if ( is_string( $t ) && $t !== '-1' ) {
+ $t = MWTimestamp::convert( TS_MW, $t );
+ }
+
return wfSetVar( $this->mCacheTime, $t );
}
return wfSetVar( $this->mCacheTime, $t );
}
@@
-120,9
+129,10
@@
class CacheTime {
public function getCacheExpiry() {
global $wgParserCacheExpireTime;
public function getCacheExpiry() {
global $wgParserCacheExpireTime;
+ // NOTE: keep support for undocumented used of -1 to mean "not cacheable".
if ( $this->mCacheTime < 0 ) {
return 0;
if ( $this->mCacheTime < 0 ) {
return 0;
- }
// old-style marker for "not cacheable"
+ }
$expire = $this->mCacheExpiry;
$expire = $this->mCacheExpiry;
@@
-157,11
+167,12
@@
class CacheTime {
public function expired( $touched ) {
global $wgCacheEpoch;
public function expired( $touched ) {
global $wgCacheEpoch;
- return !$this->isCacheable() // parser says it's uncacheable
+ $expiry = MWTimestamp::convert( TS_MW, MWTimestamp::time() - $this->getCacheExpiry() );
+
+ return !$this->isCacheable() // parser says it's not cacheable
|| $this->getCacheTime() < $touched
|| $this->getCacheTime() <= $wgCacheEpoch
|| $this->getCacheTime() < $touched
|| $this->getCacheTime() <= $wgCacheEpoch
- || $this->getCacheTime() <
- wfTimestamp( TS_MW, time() - $this->getCacheExpiry() ) // expiry period has passed
+ || $this->getCacheTime() < $expiry // expiry period has passed
|| !isset( $this->mVersion )
|| version_compare( $this->mVersion, Parser::VERSION, "lt" );
}
|| !isset( $this->mVersion )
|| version_compare( $this->mVersion, Parser::VERSION, "lt" );
}