Update PSR16 handling for multisite extension legacy caching group
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 13 Jun 2019 06:07:25 +0000 (16:07 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 13 Jun 2019 06:14:59 +0000 (16:14 +1000)
Fix version to compare against

CRM/Core/BAO/Cache/Psr16.php

index 03463d473ee56df7615266d6c2ee0faae1e7de56..1c353f74622a77934235df8ece2c7f825cfffd63 100644 (file)
@@ -180,7 +180,7 @@ class CRM_Core_BAO_Cache_Psr16 {
    * @return array
    */
   public static function getLegacyGroups() {
-    return [
+    $groups = [
       // Core
       'CiviCRM Search PrevNextCache',
       'contact fields',
@@ -202,9 +202,17 @@ class CRM_Core_BAO_Cache_Psr16 {
       // nz.co.fuzion.entitysetting
       'CiviCRM setting Spec',
 
-      // org.civicrm.multisite
-      'descendant groups for an org',
     ];
+    // Handle Legacy Multisite caching group.
+    $extensions = CRM_Extension_System::singleton()->getManager();
+    $multisiteExtensionStatus = $extensions->getStatus('org.civicrm.multisite');
+    if ($multisiteExtensionStatus == $extensions::STATUS_INSTALLED) {
+      $extension_version = civicrm_api3('Extension', 'get', ['key' => 'org.civicrm.multisite'])['values'][0]['version'];
+      if (version_compare($extension_version, '2.7', '<')) {
+        $groups[] = 'descendant groups for an org';
+      }
+    }
+    return $groups;
   }
 
 }