From 3dc4003e27e3d92f97f6bc9d52f114a3712c727d Mon Sep 17 00:00:00 2001 From: Lisa Marie Maginnis Date: Mon, 21 Sep 2015 13:18:43 -0400 Subject: [PATCH] Removed cache rebuild from the GroupContact --- CRM/Contact/BAO/Contact.php | 9 ++++++++- CRM/Contact/BAO/GroupContact.php | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index c9c9dc964c..55fab61514 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -394,7 +394,14 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact implements Civi\Co 'name' ); - CRM_Contact_BAO_Contact_Utils::clearContactCaches(); + //if (!$config->doNotResetCache) { + // Note: doNotResetCache flag is currently set by import contact process and merging, + // since resetting and + // rebuilding cache could be expensive (for many contacts). We might come out with better + // approach in future. + // HACK: Dave did this due to many donations and other requests failing due to acl_cache table locks (similar to what Dave disabled) + //CRM_Contact_BAO_Contact_Utils::clearContactCaches(); + //} if ($invokeHooks) { if ($isEdit) { diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 6105221a9d..53f92a6826 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -241,7 +241,23 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact implemen } } - CRM_Contact_BAO_Contact_Utils::clearContactCaches(); + // also reset the acl cache + $config = CRM_Core_Config::singleton(); + if (!$config->doNotResetCache) { + // HACK: Dave commented this out on 12/09/2014 due to lock wait timeouts on the acl cache that caused donations to fail. + //CRM_ACL_BAO_Cache::resetCache(); + } + + // reset the group contact cache for all group(s) + // if this group is being used as a smart group + // @todo consider what to do here - it feels like we should either + // 1) just invalidate the specific group's cache(& perhaps any parents) & let cron do it's thing or + // possibly clear this specific groups cache, or just call opportunisticCacheFlush() - which would have the + // same effect as the remove call. The reservation about that is that it is no more aggressive for the group that + // we know is altered than for all the others, or perhaps, more the point with it's parents & groups that use it in + // their criteria. + // HACK: Dave had to disable this, too! (similar to what Dave disabled) + //CRM_Contact_BAO_Contact_Utils::clearContactCaches(); CRM_Utils_Hook::post($op, 'GroupContact', $groupId, $contactIds); -- 2.25.1