From: Aaron Schulz Date: Tue, 25 Feb 2014 22:38:09 +0000 (-0800) Subject: Avoid showing crazy staleness times at ActiveUsers X-Git-Tag: 1.31.0-rc.0~16541^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=07e8e9a65a045df4797b2c86644c03f77084acf1;p=lhc%2Fweb%2Fwiklou.git Avoid showing crazy staleness times at ActiveUsers * Also do the query more aggressively on small wikis Change-Id: I089b2f69d03bb289035be11ccfe4937931904d25 --- diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index 641c046aa5..1fed51652c 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -242,7 +242,7 @@ class SpecialActiveUsers extends SpecialPage { array( 'activeusers-intro', $this->getLanguage()->formatNum( $wgActiveUserDays ) ) ); // Occasionally merge in new updates - $seconds = self::mergeActiveUsers( 600 ); + $seconds = min( self::mergeActiveUsers( 600 ), $wgActiveUserDays * 86400 ); // Mention the level of staleness $out->addWikiMsg( 'cachedspecial-viewing-cached-ttl', $this->getLanguage()->formatDuration( $seconds ) ); @@ -283,7 +283,12 @@ class SpecialActiveUsers extends SpecialPage { if ( !wfReadOnly() ) { if ( !$cTime || ( time() - wfTimestamp( TS_UNIX, $cTime ) ) > $period ) { $dbw = wfGetDB( DB_MASTER ); - self::doQueryCacheUpdate( $dbw, 2 * $period ); + if ( $dbw->estimateRowCount( 'recentchanges' ) <= 10000 ) { + $window = $wgActiveUserDays * 86400; // small wiki + } else { + $window = $period * 2; + } + self::doQueryCacheUpdate( $dbw, $window ); } } return ( time() -