diff options
Diffstat (limited to 'includes/deferred/SiteStatsUpdate.php')
-rw-r--r-- | includes/deferred/SiteStatsUpdate.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/deferred/SiteStatsUpdate.php b/includes/deferred/SiteStatsUpdate.php index 97a17c39..ae75a754 100644 --- a/includes/deferred/SiteStatsUpdate.php +++ b/includes/deferred/SiteStatsUpdate.php @@ -65,6 +65,8 @@ class SiteStatsUpdate implements DeferrableUpdate { public function doUpdate() { global $wgSiteStatsAsyncFactor; + $this->doUpdateContextStats(); + $rate = $wgSiteStatsAsyncFactor; // convenience // If set to do so, only do actual DB updates 1 every $rate times. // The other times, just update "pending delta" values in memcached. @@ -128,7 +130,7 @@ class SiteStatsUpdate implements DeferrableUpdate { */ public static function cacheUpdate( $dbw ) { global $wgActiveUserDays; - $dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow' ) ); + $dbr = wfGetDB( DB_SLAVE, 'vslow' ); # Get non-bot users than did some recent action other than making accounts. # If account creation is included, the number gets inflated ~20+ fold on enwiki. $activeUsers = $dbr->selectField( @@ -153,6 +155,16 @@ class SiteStatsUpdate implements DeferrableUpdate { return $activeUsers; } + protected function doUpdateContextStats() { + $stats = RequestContext::getMain()->getStats(); + foreach ( array( 'edits', 'articles', 'pages', 'users', 'images' ) as $type ) { + $delta = $this->$type; + if ( $delta !== 0 ) { + $stats->updateCount( "site.$type", $delta ); + } + } + } + protected function doUpdatePendingDeltas() { $this->adjustPending( 'ss_total_edits', $this->edits ); $this->adjustPending( 'ss_good_articles', $this->articles ); |