Legoktm has uploaded a new change for review.

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

Change subject: If users match email with the global account winner, don't 
rename them
......................................................................

If users match email with the global account winner, don't rename them

Change-Id: I352a32580c99a0ec5c5670cf99c15b6c6e98a803
---
M maintenance/populateListOfUsersToRename.php
1 file changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/97/193497/1

diff --git a/maintenance/populateListOfUsersToRename.php 
b/maintenance/populateListOfUsersToRename.php
index 2dd99e9..ff57f48 100644
--- a/maintenance/populateListOfUsersToRename.php
+++ b/maintenance/populateListOfUsersToRename.php
@@ -71,19 +71,35 @@
                                $this->lName = $row->name;
                                $this->lWiki = $row->wiki;
                                if ( $cache->has( $row->name ) ) {
-                                       $home = $cache->get( $row->name );
+                                       $attachableWikis = $cache->get( 
$row->name );
                                } else {
                                        $ca = new CentralAuthUser( $row->name );
+                                       $attachableWikis = array();
+                                       $unattached = $ca->queryUnattached();
                                        if ( $ca->exists() ) {
                                                $home = $ca->getHomeWiki();
+                                               $attachableWikis[] = $home;
+                                               foreach ( $unattached as $wiki 
=> $info ) {
+                                                       if ( $info['email'] === 
$ca->getEmail() && !is_null( $info['emailAuthenticated'] ) ) {
+                                                               
$attachableWikis[] = $wiki;
+                                                       }
+                                               }
                                        } else {
-                                               $home = $ca->chooseHomeWiki( 
$ca->queryUnattached() );
+                                               $home = $ca->chooseHomeWiki( 
$unattached );
+                                               $attachableWikis[] = $home;
+                                               if ( 
$unattached[$home]['email'] && isset( $unattached[$home]['emailAuthenticated'] 
) ) {
+                                                       foreach ( $unattached 
as $wiki => $info ) {
+                                                               if ( $wiki !== 
$home && $unattached[$home]['email'] === $info['email'] && isset( 
$info['emailAuthenticated'] ) ) {
+                                                                       
$attachableWikis[] = $wiki;
+                                                               }
+                                                       }
+                                               }
                                        }
                                        $cache->set( $row->name, $home );
                                }
 
-                               if ( $home !== $row->wiki ) {
-                                       // Unattached account which is not on 
the home wiki,
+                               if ( !in_array( $row->wiki, $attachableWikis )  
) {
+                                       // Unattached account which is not 
attachable,
                                        // so they're getting renamed :(
                                        $insertRows[] = (array)$row;
                                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I352a32580c99a0ec5c5670cf99c15b6c6e98a803
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to