Convert Navigation cache group to current cache defition system
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 18 Jun 2019 22:21:31 +0000 (08:21 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 12 Jul 2019 21:21:27 +0000 (07:21 +1000)
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

CRM/Admin/Form/Setting/Localization.php
CRM/Core/BAO/Cache/Psr16.php
CRM/Core/BAO/ConfigSetting.php
CRM/Core/BAO/Navigation.php
CRM/Utils/System.php
Civi/Core/Container.php

index e87f459575f1cf0a88d51943ddaac0f28d7e1f6c..e5c52cd7c335b47b021150de0d2c3391c4bb94ca 100644 (file)
@@ -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();
index efc723a3fa01e9b7d7f99c6f626e098af700bc37..34aa47cd8916d94ec16c422f065d3ba15dd1fe51 100644 (file)
@@ -183,7 +183,6 @@ class CRM_Core_BAO_Cache_Psr16 {
     $groups = [
       // Core
       'contact fields',
-      'navigation',
       'custom data',
 
       // Universe
index 946890452edbcd6b09bd3870a7b5b470b8ca02a5..8919a6d79095ec8cbb583e4a82875029bb12e897 100644 (file)
@@ -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;
index bac09cd73cc19a0a3dc3f9cb2f91a692ae96f078..44a536a424d3d4a420228c6e94f4d9fdcf3a1991 100644 (file)
@@ -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
index 2ba2d976d1fe7b8fe1e5169b494ede10a98cc487..b89d56cd0c03b8ae65592db5fa27eb860e596573 100644 (file)
@@ -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();
     }
index 853299498b870c9a89287d537d39df6ed8c377a9..1587f7263d0166feca2905c2a481b99debcbfe25 100644 (file)
@@ -157,6 +157,7 @@ class Container {
       'session' => 'CiviCRM Session',
       'long' => 'long',
       'groups' => 'contact groups',
+      'navigation' => 'navigation',
     ];
     foreach ($basicCaches as $cacheSvc => $cacheGrp) {
       $definitionParams = [