Commit 96689db3 authored by Seamus Lee's avatar Seamus Lee

Convert Navigation cache group to current cache defition system

Also reset memory and system caches when resetting navigation

Additonal place to cause extra flush

Add in utility function for resetting ACL and System Level Caches

Use cache utility function
parent e38990f9
......@@ -187,7 +187,9 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
CRM_Core_BAO_Cache::deleteGroup('contact fields');
//CRM-8559, cache navigation do not respect locale if it is changed, so reseting cache.
CRM_Core_BAO_Cache::deleteGroup('navigation');
Civi::cache('navigation')->flush();
// reset ACL and System caches
CRM_Core_BAO_Cache::resetCaches();
// we do this only to initialize monetary decimal point and thousand separator
$config = CRM_Core_Config::singleton();
......
......@@ -183,7 +183,6 @@ class CRM_Core_BAO_Cache_Psr16 {
$groups = [
// Core
'contact fields',
'navigation',
'custom data',
// Universe
......
......@@ -156,7 +156,7 @@ class CRM_Core_BAO_ConfigSetting {
//CRM-8559, cache navigation do not respect locale if it is changed, so reseting cache.
// Ed: This doesn't sound good.
// CRM_Core_BAO_Cache::deleteGroup('navigation');
// Civi::cache('navigation')->flush();
}
else {
$requestLocale = NULL;
......
......@@ -165,7 +165,7 @@ class CRM_Core_BAO_Navigation extends CRM_Core_DAO_Navigation {
$config = CRM_Core_Config::singleton();
// check if we can retrieve from database cache
$navigations = CRM_Core_BAO_Cache::getItem('navigation', $cacheKeyString);
$navigations = Civi::cache('navigation')->get($cacheKeyString);
if (!$navigations) {
$domainID = CRM_Core_Config::domainID();
......@@ -186,7 +186,7 @@ FROM civicrm_navigation WHERE domain_id = $domainID";
$navigations = [];
self::_getNavigationLabel($pidGroups[''], $navigations);
CRM_Core_BAO_Cache::setItem($navigations, 'navigation', $cacheKeyString);
Civi::cache('navigation')->set($cacheKeyString, $navigations);
}
return $navigations;
}
......@@ -567,7 +567,9 @@ FROM civicrm_navigation WHERE domain_id = $domainID";
$ser = serialize($newKey);
$query = "UPDATE civicrm_setting SET value = '$ser' WHERE name='navigation' AND contact_id IS NOT NULL";
CRM_Core_DAO::executeQuery($query);
CRM_Core_BAO_Cache::deleteGroup('navigation');
Civi::cache('navigation')->flush();
// reset ACL and System caches
CRM_Core_BAO_Cache::resetCaches();
}
else {
// before inserting check if contact id exists in db
......
......@@ -1440,6 +1440,7 @@ class CRM_Utils_System {
Civi::cache('js_strings')->flush();
Civi::cache('community_messages')->flush();
Civi::cache('groups')->flush();
Civi::cache('navigation')->flush();
CRM_Extension_System::singleton()->getCache()->flush();
CRM_Cxn_CiviCxnHttp::singleton()->getCache()->flush();
}
......
......@@ -157,6 +157,7 @@ class Container {
'session' => 'CiviCRM Session',
'long' => 'long',
'groups' => 'contact groups',
'navigation' => 'navigation',
];
foreach ($basicCaches as $cacheSvc => $cacheGrp) {
$definitionParams = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment