From 2ef08d7d499acb7cf2aacce96892b45e2e7d8db4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 17 Jul 2014 12:32:51 -0700 Subject: [PATCH] Fixed initial as-of cache time shown at Special:ActiveUsers Change-Id: I97c662a0c2b912924df07bd2cde790535026005c --- includes/specials/SpecialActiveusers.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index e25955f664..6db9e5fa8e 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -295,6 +295,7 @@ class SpecialActiveUsers extends SpecialPage { 'qci_timestamp', array( 'qci_type' => 'activeusers' ) ); + if ( !wfReadOnly() ) { if ( !$cTime || ( time() - wfTimestamp( TS_UNIX, $cTime ) ) > $period ) { $dbw = wfGetDB( DB_MASTER ); @@ -303,7 +304,7 @@ class SpecialActiveUsers extends SpecialPage { } else { $window = $period * 2; } - self::doQueryCacheUpdate( $dbw, $window ); + $cTime = self::doQueryCacheUpdate( $dbw, $window ) ?: $cTime; } } @@ -326,7 +327,7 @@ class SpecialActiveUsers extends SpecialPage { * * @param DatabaseBase $dbw * @param int $window Maximum time range of new data to scan (in seconds) - * @return bool Success + * @return int|bool UNIX timestamp the cache is now up-to-date as of (false on error) */ protected static function doQueryCacheUpdate( DatabaseBase $dbw, $window ) { global $wgActiveUserDays; @@ -426,6 +427,6 @@ class SpecialActiveUsers extends SpecialPage { $dbw->unlock( $lockKey, __METHOD__ ); - return true; + return $eTimestamp; } } -- 2.20.1