Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Stop passing cacheKey to refillCache #14337

Merged
merged 1 commit into from
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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