Skip to content

Commit

Permalink
Merge pull request #14337 from eileenmcnaughton/dedupe_cleanup
Browse files Browse the repository at this point in the history
[REF] Stop passing cacheKey to refillCache
  • Loading branch information
seamuslee001 authored Jun 2, 2019
2 parents b95597c + e1e24a5 commit cf6700a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
12 changes: 2 additions & 10 deletions CRM/Core/BAO/PrevNextCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ public static function getCount($cacheKey, $join = NULL, $where = NULL, $op = "=
*
* @param int $rgid
* @param int $gid
* @param NULL $cacheKeyString
* @param array $criteria
* Additional criteria to filter by.
*
Expand All @@ -371,18 +370,11 @@ public static function getCount($cacheKey, $join = NULL, $where = NULL, $op = "=
* The search methodology finds all matches for the searchedContacts so this limits
* the number of searched contacts, not the matches found.
*
* @return bool
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public static function refillCache($rgid, $gid, $cacheKeyString, $criteria, $checkPermissions, $searchLimit = 0) {
if (!$cacheKeyString && $rgid) {
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions);
}

if (!$cacheKeyString) {
return FALSE;
}
public static function refillCache($rgid, $gid, $criteria, $checkPermissions, $searchLimit = 0) {
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions);

// 1. Clear cache if any
$sql = "DELETE FROM civicrm_prevnext_cache WHERE cachekey LIKE %1";
Expand Down
19 changes: 10 additions & 9 deletions CRM/Dedupe/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -1848,11 +1848,10 @@ public static function createMergeActivities($mainId, $otherId) {
public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) {
$dupePairs = self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions);
if (empty($dupePairs) && $reloadCacheIfEmpty) {
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions);
// If we haven't found any dupes, probably cache is empty.
// Try filling cache and give another try. We don't need to specify include conflicts here are there will not be any
// until we have done some processing.
CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $cacheKeyString, $criteria, $checkPermissions, $searchLimit);
CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit);
return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions);
}
return $dupePairs;
Expand Down Expand Up @@ -2422,13 +2421,15 @@ public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) {
}

/**
* @param $rule_group_id
* @param $group_id
* @param $batchLimit
* @param $isSelected
* @param $includeConflicts
* @param $criteria
* @param $checkPermissions
* Get any duplicate merge pairs that have been previously cached.
*
* @param int $rule_group_id
* @param int $group_id
* @param int $batchLimit
* @param bool $isSelected
* @param bool $includeConflicts
* @param array $criteria
* @param int $checkPermissions
*
* @return array
*/
Expand Down

0 comments on commit cf6700a

Please sign in to comment.