From: Aaron Schulz Date: Sun, 13 Sep 2009 16:50:35 +0000 (+0000) Subject: For wikis with $wgMiserMode off, update activeuser count daily rather than per page... X-Git-Tag: 1.31.0-rc.0~39754 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=4523f652039ef47b1b685eac61788a155259e0ce;p=lhc%2Fweb%2Fwiklou.git For wikis with $wgMiserMode off, update activeuser count daily rather than per page view. Those with $wgMiserMode on still use $wgSpecialPageCacheUpdates. --- diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index ea2b5be8b7..6e88a09fd2 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -23,7 +23,7 @@ class SpecialStatistics extends SpecialPage { } public function execute( $par ) { - global $wgOut, $wgRequest, $wgMessageCache; + global $wgOut, $wgRequest, $wgMessageCache, $wgMemc; global $wgDisableCounters, $wgMiserMode; $wgMessageCache->loadAllMessages(); @@ -48,8 +48,13 @@ class SpecialStatistics extends SpecialPage { # Set active user count if( !$wgMiserMode ) { - $dbw = wfGetDB( DB_MASTER ); - SiteStatsUpdate::cacheUpdate( $dbw ); + $key = wfMemcKey( 'sitestats', 'activeusers-updated' ); + // Re-calculate the count if the last tally is old... + if( !$wgMemc->get($key) ) { + $dbw = wfGetDB( DB_MASTER ); + SiteStatsUpdate::cacheUpdate( $dbw ); + $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day + } } # Do raw output