Callers using wfTimestamp( TS_UNIX, ... ) where getting $minTTL
due to the output being a string number.
Change-Id: I6b67a941940f40ef9a543f11d0dbccacafaaa53b
* @since 1.28
*/
public function adaptiveTTL( $mtime, $maxTTL, $minTTL = 30, $factor = .2 ) {
- if ( is_float( $mtime ) ) {
- $mtime = (int)$mtime; // ignore fractional seconds
+ if ( is_float( $mtime ) || ctype_digit( $mtime ) ) {
+ $mtime = (int)$mtime; // handle fractional seconds and string integers
}
if ( !is_int( $mtime ) || $mtime <= 0 ) {
$this->assertGreaterThanOrEqual( $adaptiveTTL - $margin, $ttl );
$this->assertLessThanOrEqual( $adaptiveTTL + $margin, $ttl );
+
+ $ttl = $this->cache->adaptiveTTL( (string)$mtime, $maxTTL, $minTTL, $factor );
+
+ $this->assertGreaterThanOrEqual( $adaptiveTTL - $margin, $ttl );
+ $this->assertLessThanOrEqual( $adaptiveTTL + $margin, $ttl );
}
public static function provideAdaptiveTTL() {