dev/core#1964 Fix regression bug on deduping contacts with dedupe_exception matches
authoreileen <emcnaughton@wikimedia.org>
Fri, 21 Aug 2020 22:36:18 +0000 (10:36 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 21 Aug 2020 22:59:51 +0000 (10:59 +1200)
I want to do another pass on this & do more SELECT queries & less UPDATE queries so we are doing
less locking - but for now this should get us past the logged regression

CRM/Dedupe/Merger.php

index 3cc6e233f202bdeb98f731b08b62e673c84738f5..c4be7070d9bb2d20e3e660b608c1a09a3263c282 100644 (file)
@@ -541,6 +541,13 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         continue;
       }
 
+      if ($table === 'civicrm_dedupe_exception') {
+        $sqls[] = "UPDATE IGNORE civicrm_dedupe_exception SET contact_id1 = $mainId WHERE contact_id1 = $otherId";
+        $sqls[] = "UPDATE IGNORE civicrm_dedupe_exception SET contact_id2 = $mainId WHERE contact_id2 = $otherId";
+        $sqls[] = "DELETE FROM civicrm_dedupe_exception WHERE contact_id1 = $otherId OR contact_id2 = $otherId";
+        continue;
+      }
+
       if ($table === 'civicrm_setting') {
         // Per https://lab.civicrm.org/dev/core/-/issues/1934
         // Note this line is not unit tested as yet as a quick-fix for a regression