(dev/core#174) Forms/Sessions - Clear in roughly the same ways as before
authorTim Otten <totten@civicrm.org>
Thu, 28 Jun 2018 03:19:58 +0000 (20:19 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 2 Jul 2018 05:08:23 +0000 (22:08 -0700)
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
CRM/Admin/Form/Setting/UpdateConfigBackend.php
CRM/Core/BAO/ConfigSetting.php
CRM/Core/Config.php

index e19ff5128651bf947469ff469ecc61044e0d8f02..695f6f097df4bcf63c494d270d9bafe460934f46 100644 (file)
@@ -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();
 
index 68711ff42aa69d2413052c28239f27c7e18c4508..b5c7bb8c57b89612c3aa06888d6e98f7a031ba05 100644 (file)
@@ -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();
index 8cc765328614251e238f1584ea598fd56b2c3fcf..bb5340bbec4ab108cc6bd7687128cfe81121e25d 100644 (file)
@@ -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.') . '<br />';
 
     $resetSessionTable = CRM_Utils_Request::retrieve('resetSessionTable',
index 14baccd3510bbf540346c75b484973fab1052071..265532c67d8b07d711c30925656f9a47682acf97 100644 (file)
@@ -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) {