Skip to content

Commit

Permalink
(dev/core#174) Forms/Sessions - Clear in roughly the same ways as before
Browse files Browse the repository at this point in the history
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
* #12362 (comment)
  • Loading branch information
totten committed Jun 28, 2018
1 parent b6d24f2 commit 0af65c9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CRM/Admin/Form/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public function commonProcess(&$params) {
}

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();

Expand Down
1 change: 1 addition & 0 deletions CRM/Admin/Form/Setting/UpdateConfigBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function postProcess() {

// clear all caches
CRM_Core_Config::clearDBCache();
Civi::cache('session')->clear();
CRM_Utils_System::flushCache();

parent::rebuildMenu();
Expand Down
1 change: 1 addition & 0 deletions CRM/Core/BAO/ConfigSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public static function doSiteMove($defaultValues = array()) {

// clear all caches
CRM_Core_Config::clearDBCache();
Civi::cache('session')->clear();
$moveStatus .= ts('Database cache tables cleared.') . '<br />';

$resetSessionTable = CRM_Utils_Request::retrieve('resetSessionTable',
Expand Down
1 change: 1 addition & 0 deletions CRM/Core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ public function cleanupCaches($sessionReset = TRUE) {

// clear all caches
self::clearDBCache();
Civi::cache('session')->clear();
CRM_Utils_System::flushCache();

if ($sessionReset) {
Expand Down

0 comments on commit 0af65c9

Please sign in to comment.