Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/214512

Change subject: Update context stats in SiteStatsUpdate
......................................................................

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
---
M includes/deferred/SiteStatsUpdate.php
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/12/214512/1

diff --git a/includes/deferred/SiteStatsUpdate.php 
b/includes/deferred/SiteStatsUpdate.php
index 3c77238..ff74c80 100644
--- a/includes/deferred/SiteStatsUpdate.php
+++ b/includes/deferred/SiteStatsUpdate.php
@@ -65,6 +65,8 @@
        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 @@
                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", $this->$type 
);
+                       }
+               }
+       }
+
        protected function doUpdatePendingDeltas() {
                $this->adjustPending( 'ss_total_edits', $this->edits );
                $this->adjustPending( 'ss_good_articles', $this->articles );

-- 
To view, visit https://gerrit.wikimedia.org/r/214512
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc12c07ab4233e1105a402b80d290bdb64df6ea7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to