From ddd2e3cb587986c897ef401c234606a9a45db14f Mon Sep 17 00:00:00 2001 From: scardinius <scardinius@chords.pl> Date: Wed, 7 Apr 2021 10:38:51 +0200 Subject: [PATCH 1/2] dev/core#2516 Invalidate only smart groups --- CRM/Contact/BAO/GroupContactCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index 3e75e851333f..f8f45dbe8344 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -578,7 +578,7 @@ public static function getCacheInvalidDateTime() { public static function invalidateGroupContactCache($groupID) { CRM_Core_DAO::executeQuery("UPDATE civicrm_group SET cache_date = NULL - WHERE id = %1", [ + WHERE id = %1 AND saved_search_id IS NOT NULL", [ 1 => [$groupID, 'Positive'], ]); } From 38b0ad12b043f43ff41cc8d70a649801307d34df Mon Sep 17 00:00:00 2001 From: scardinius <scardinius@chords.pl> Date: Wed, 14 Apr 2021 10:15:03 +0200 Subject: [PATCH 2/2] dev/core#2516 Invalidate only smart groups - is smart group or has children --- CRM/Contact/BAO/GroupContactCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index f8f45dbe8344..876b6dfd6855 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -578,7 +578,7 @@ public static function getCacheInvalidDateTime() { public static function invalidateGroupContactCache($groupID) { CRM_Core_DAO::executeQuery("UPDATE civicrm_group SET cache_date = NULL - WHERE id = %1 AND saved_search_id IS NOT NULL", [ + WHERE id = %1 AND (saved_search_id IS NOT NULL OR children IS NOT NULL)", [ 1 => [$groupID, 'Positive'], ]); }