jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358152 )

Change subject: Use info itself instead of array index
......................................................................


Use info itself instead of array index

Also remove unused variable.

Bug: T167354
Change-Id: I543bcf9c1b3c083288294d2f504378ccafb501d9
---
M LoginNotify_body.php
1 file changed, 10 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Kaldari: Looks good to me, approved



diff --git a/LoginNotify_body.php b/LoginNotify_body.php
index 6828422..059b86a 100644
--- a/LoginNotify_body.php
+++ b/LoginNotify_body.php
@@ -191,7 +191,6 @@
                // edited the most. We only do top ten, to limit the worst-case 
where the
                // user has accounts on 800 wikis.
                if ( class_exists( 'CentralAuthUser' ) ) {
-                       $wikisByEditCounts = [];
                        $globalUser = CentralAuthUser::getInstance( $user );
                        if ( $globalUser->exists() ) {
                                // This is expensive. However, On WMF wikis, 
probably
@@ -207,17 +206,24 @@
                                        }
                                );
                                $count = 0;
-                               foreach ( $info as $wiki => $localInfo ) {
+                               $total = count( $info );
+                               foreach ( $info as $localInfo ) {
+                                       if ( !isset( $localInfo['id'] ) || 
!isset( $localInfo['wiki'] ) ) {
+                                               wfDebugLog( 'AdHocDebug', 
"Unexpected user data [$count/$total]: "
+                                                       . print_r( $localInfo, 
true ) );
+                                               break;
+                                       }
                                        if ( $count > 10 || 
$localInfo['editCount'] < 1 ) {
                                                break;
                                        }
+                                       $wiki = $localInfo['wiki'];
                                        try {
                                                $lb = wfGetLB( $wiki );
                                                $dbrLocal = $lb->getConnection( 
DB_SLAVE, [], $wiki );
                                        } catch ( DBConnectionError $ex ) {
                                                // FIXME: sometimes, we get 
garbage wiki names (T167354)
-                                               wfDebugLog( 'AdHocDebug', 
"Couldn't connect to database $wiki, info: "
-                                                       . json_encode( $info ) 
);
+                                               wfDebugLog( 'AdHocDebug', 
"Couldn't connect to database $wiki [$count/$total], info: "
+                                                       . print_r( $localInfo, 
true ) );
                                                continue;
                                        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I543bcf9c1b3c083288294d2f504378ccafb501d9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/LoginNotify
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: Niharika29 <nko...@wikimedia.org>
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