From 5e601882471fcebee415892c2847805f7bac825e Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 22 Jun 2019 13:41:17 +1000 Subject: [PATCH] Replicate current practice of resetting of ACL and System caches sensibly --- CRM/ACL/BAO/ACL.php | 6 ++---- CRM/ACL/Form/ACL.php | 2 ++ CRM/Core/BAO/CustomGroup.php | 2 ++ CRM/Custom/Form/ChangeFieldType.php | 2 ++ CRM/Custom/Form/Group.php | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index aafc2cf2a1..71050fffbc 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -688,10 +688,8 @@ SELECT $acl.* */ public static function setIsActive($id, $is_active) { Civi::cache('fields')->flush(); - // also reset ACL Cache - CRM_ACL_BAO_Cache::resetCache(); - // also reset memory cache if any - CRM_Utils_System::flushCache(); + // reset ACL and system caches. + CRM_Core_BAO_Cache::resetCaches(); return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_ACL', $id, 'is_active', $is_active); } diff --git a/CRM/ACL/Form/ACL.php b/CRM/ACL/Form/ACL.php index b0824e56b2..7f94197214 100644 --- a/CRM/ACL/Form/ACL.php +++ b/CRM/ACL/Form/ACL.php @@ -255,6 +255,8 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form { public function postProcess() { // note this also resets any ACL cache Civi::cache('fields')->flush(); + // reset ACL and system caches. + CRM_Core_BAO_Cache::resetCaches(); if ($this->_action & CRM_Core_Action::DELETE) { CRM_ACL_BAO_ACL::del($this->_id); diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index b4da3671a1..3f92e2696b 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -260,6 +260,8 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup { public static function setIsActive($id, $is_active) { // reset the cache Civi::cache('fields')->flush(); + // reset ACL and system caches. + CRM_Core_BAO_Cache::resetCaches(); if (!$is_active) { CRM_Core_BAO_UFField::setUFFieldStatus($id, $is_active); diff --git a/CRM/Custom/Form/ChangeFieldType.php b/CRM/Custom/Form/ChangeFieldType.php index eb079dff19..06ff652e35 100644 --- a/CRM/Custom/Form/ChangeFieldType.php +++ b/CRM/Custom/Form/ChangeFieldType.php @@ -188,6 +188,8 @@ class CRM_Custom_Form_ChangeFieldType extends CRM_Core_Form { // Reset cache for custom fields Civi::cache('fields')->flush(); + // reset ACL and system caches. + CRM_Core_BAO_Cache::resetCaches(); CRM_Core_Session::setStatus(ts('Input type of custom field \'%1\' has been successfully changed to \'%2\'.', [1 => $this->_values['label'], 2 => $dstHtmlType] diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index bdc2929402..5da4dd727f 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -458,6 +458,8 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { // reset the cache Civi::cache('fields')->flush(); + // reset ACL and system caches. + CRM_Core_BAO_Cache::resetCaches(); if ($this->_action & CRM_Core_Action::UPDATE) { CRM_Core_Session::setStatus(ts('Your custom field set \'%1 \' has been saved.', [1 => $group->title]), ts('Saved'), 'success'); -- 2.25.1