From: Ori Livneh Date: Fri, 29 May 2015 00:55:17 +0000 (-0700) Subject: Update context stats in SiteStatsUpdate X-Git-Tag: 1.31.0-rc.0~11264^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=6542746e6c18a19ab5937cb237aae72f0067dd33;p=lhc%2Fweb%2Fwiklou.git Update context stats in SiteStatsUpdate In addition to updating the database / memcached, make SiteStatsUpdate also update the context stats object with the deltas it is processing. Change-Id: Icc12c07ab4233e1105a402b80d290bdb64df6ea7 --- diff --git a/includes/deferred/SiteStatsUpdate.php b/includes/deferred/SiteStatsUpdate.php index 3c7723810d..ae75a7549c 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. @@ -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 );