Aude has uploaded a new change for review.

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

Change subject: More clear variable and method naming in 
ChangesSubscriptionTableBuilder
......................................................................

More clear variable and method naming in ChangesSubscriptionTableBuilder

ChangesSubscriptionTableBuilder seems to have nothing to do
with EntityPerPage, among other things that were not as clear
as they could be.

the slurpSubscriptions method is tricky to name because it
does more than one thing for each row it processes, so couldn't
come up with the perfect name but think this is better.

Change-Id: I489188c7dba5cb871f15b73292b44c9ce9dba158
---
M repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
1 file changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/29/198229/4

diff --git a/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php 
b/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
index 1564e39..9a3039d 100644
--- a/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
+++ b/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
@@ -122,13 +122,13 @@
        private function processSubscriptionBatch( &$continuation = array() ) {
                $db = $this->loadBalancer->getConnection( DB_MASTER );
 
-               $entityPerPage = $this->getSubscriptionBatch( $db, 
$continuation );
+               $subscriptionPerItemBatch = $this->getSubscriptionBatch( $db, 
$continuation );
 
-               if ( empty( $entityPerPage ) ) {
+               if ( empty( $subscriptionPerItemBatch ) ) {
                        return 0;
                }
 
-               $count = $this->insertSubscriptionBatch( $db, $entityPerPage );
+               $count = $this->insertSubscriptionBatch( $db, 
$subscriptionsPerItemBatch );
 
                $this->loadBalancer->reuseConnection( $db );
 
@@ -195,33 +195,33 @@
                        )
                );
 
-               return $this->slurpSubscriptions( $res, $continuation );
+               return $this->makeSubscriptionBatchFromRows( $res, 
$continuation );
        }
 
        /**
         * @param ResultWrapper $res A result set with the ips_item_id and 
ips_site_id fields
         *        set for each row.
-        * @param array &$continuation
+        * @param array &$continuation Single item ID => site ID pair or empty.
         *
         * @return array[] An associative array mapping item IDs to lists of 
site IDs.
         */
-       private function slurpSubscriptions( ResultWrapper $res, &$continuation 
= array() ) {
-               $entityPerPage = array();
+       private function makeSubscriptionBatchFromRows( ResultWrapper $res, 
&$continuation = array() ) {
+               $subscriptionsPerItem = array();
 
                $currentId = 0;
-               $key = null;
+               $itemId = null;
 
                foreach ( $res as $row ) {
                        if ( $row->ips_item_id != $currentId ) {
-                               $currentId = $row->ips_item_id;
-                               $key = ItemId::newFromNumber( $currentId 
)->getSerialization();
+                               $currentItemId = $row->ips_item_id;
+                               $itemId = ItemId::newFromNumber( $currentItemId 
)->getSerialization();
                        }
 
-                       $entityPerPage[$key][] = $row->ips_site_id;
-                       $continuation = array( $currentId, $row->ips_site_id );
+                       $subscriptionsPerItem[$itemId][] = $row->ips_site_id;
+                       $continuation = array( $currentItemId, 
$row->ips_site_id );
                }
 
-               return $entityPerPage;
+               return $subscriptionsPerItem;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I489188c7dba5cb871f15b73292b44c9ce9dba158
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to