dev/core#2087 move uf_match check above the primary check
authoreileen <emcnaughton@wikimedia.org>
Fri, 2 Oct 2020 22:07:37 +0000 (11:07 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 5 Oct 2020 23:16:21 +0000 (12:16 +1300)
the uf_match check will result in an early return more often than the other

CRM/Core/BAO/UFMatch.php

index 9e61b990b3ce6c9ee5c9318913ecda59504f8226..9d0a58bbac35ac79ab05c4c95ee07f6a5bf721de 100644 (file)
@@ -340,6 +340,14 @@ AND    domain_id    = %4
       return;
     }
 
+    // 1.do check for contact Id.
+    $ufmatch = new CRM_Core_DAO_UFMatch();
+    $ufmatch->contact_id = $contactId;
+    $ufmatch->domain_id = CRM_Core_Config::domainID();
+    if (!$ufmatch->find(TRUE)) {
+      return;
+    }
+
     $config = CRM_Core_Config::singleton();
     $ufName = CRM_Contact_BAO_Contact::getPrimaryEmail($contactId);
 
@@ -349,13 +357,6 @@ AND    domain_id    = %4
 
     $update = FALSE;
 
-    // 1.do check for contact Id.
-    $ufmatch = new CRM_Core_DAO_UFMatch();
-    $ufmatch->contact_id = $contactId;
-    $ufmatch->domain_id = CRM_Core_Config::domainID();
-    if (!$ufmatch->find(TRUE)) {
-      return;
-    }
     if ($ufmatch->uf_name != $ufName) {
       $update = TRUE;
     }