Merge "Fixed initial as-of cache time shown at Special:ActiveUsers"

This commit is contained in:
jenkins-bot 2014-07-17 19:41:39 +00:00 committed by Gerrit Code Review
commit 20a25dc1e9

View file

@ -295,6 +295,7 @@ class SpecialActiveUsers extends SpecialPage {
'qci_timestamp', 'qci_timestamp',
array( 'qci_type' => 'activeusers' ) array( 'qci_type' => 'activeusers' )
); );
if ( !wfReadOnly() ) { if ( !wfReadOnly() ) {
if ( !$cTime || ( time() - wfTimestamp( TS_UNIX, $cTime ) ) > $period ) { if ( !$cTime || ( time() - wfTimestamp( TS_UNIX, $cTime ) ) > $period ) {
$dbw = wfGetDB( DB_MASTER ); $dbw = wfGetDB( DB_MASTER );
@ -303,7 +304,7 @@ class SpecialActiveUsers extends SpecialPage {
} else { } else {
$window = $period * 2; $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 DatabaseBase $dbw
* @param int $window Maximum time range of new data to scan (in seconds) * @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 ) { protected static function doQueryCacheUpdate( DatabaseBase $dbw, $window ) {
global $wgActiveUserDays; global $wgActiveUserDays;
@ -426,6 +427,6 @@ class SpecialActiveUsers extends SpecialPage {
$dbw->unlock( $lockKey, __METHOD__ ); $dbw->unlock( $lockKey, __METHOD__ );
return true; return $eTimestamp;
} }
} }