From 0a12cd4a2a195ee89e0a2b7ba8ba457987b7f277 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 27 Jun 2018 20:19:58 -0700 Subject: [PATCH] (dev/core#174) Forms/Sessions - Clear in roughly the same ways as before In the past, if one clears the `civicrm_cache` table (i.e. by calling `CRM_Core_Config::clearDBCache()` ==> `TRUNCATE TABLE civicrm_cache`), then it has the effect of destroying any active sessions/forms. Now, in allowing sessions to be stored elsewhere, we lose that side-effect. If we want strictly equivalent behavior (from a business-logic perspective), then we'd want the patch to go a bit further -- calling Civi::cache('session')->clear() at the same time that it does `clearDBCache()`. This revision adds `clear()` calls to various spots discussed here: * https://docs.google.com/spreadsheets/d/1FxuIvr2noelBvhu5eja9_ps3YUWnkmGhqijBO3gH8Po/edit?usp=sharing * https://github.com/civicrm/civicrm-core/pull/12362#issuecomment-400897782 --- CRM/Admin/Form/Setting.php | 1 + CRM/Admin/Form/Setting/UpdateConfigBackend.php | 1 + CRM/Core/BAO/ConfigSetting.php | 1 + CRM/Core/Config.php | 1 + 4 files changed, 4 insertions(+) diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index e19ff51286..695f6f097d 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -233,6 +233,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } CRM_Core_Config::clearDBCache(); + Civi::cache('session')->clear(); // This doesn't make a lot of sense to me, but it maintains pre-existing behavior. CRM_Utils_System::flushCache(); CRM_Core_Resources::singleton()->resetCacheCode(); diff --git a/CRM/Admin/Form/Setting/UpdateConfigBackend.php b/CRM/Admin/Form/Setting/UpdateConfigBackend.php index 68711ff42a..b5c7bb8c57 100644 --- a/CRM/Admin/Form/Setting/UpdateConfigBackend.php +++ b/CRM/Admin/Form/Setting/UpdateConfigBackend.php @@ -65,6 +65,7 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting // clear all caches CRM_Core_Config::clearDBCache(); + Civi::cache('session')->clear(); CRM_Utils_System::flushCache(); parent::rebuildMenu(); diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 8cc7653286..bb5340bbec 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -260,6 +260,7 @@ class CRM_Core_BAO_ConfigSetting { // clear all caches CRM_Core_Config::clearDBCache(); + Civi::cache('session')->clear(); $moveStatus .= ts('Database cache tables cleared.') . '
'; $resetSessionTable = CRM_Utils_Request::retrieve('resetSessionTable', diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index 14baccd351..265532c67d 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -295,6 +295,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { // clear all caches self::clearDBCache(); + Civi::cache('session')->clear(); CRM_Utils_System::flushCache(); if ($sessionReset) { -- 2.25.1