Alter PSR16 code to take into account of new entitysetting release with upgraded...
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 16 Jun 2019 22:31:28 +0000 (08:31 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 16 Jun 2019 22:31:28 +0000 (08:31 +1000)
CRM/Core/BAO/Cache/Psr16.php

index b1de19199694dd1c85e2b8a49bf8907bb7a8effd..953d079618cb56f713dd9a49c56b0006b1f96203 100644 (file)
@@ -199,9 +199,6 @@ class CRM_Core_BAO_Cache_Psr16 {
       // civihr/uk.co.compucorp.civicrm.hrcore
       'HRCore_Info',
 
-      // nz.co.fuzion.entitysetting
-      'CiviCRM setting Spec',
-
     ];
     // Handle Legacy Multisite caching group.
     $extensions = CRM_Extension_System::singleton()->getManager();
@@ -216,6 +213,17 @@ class CRM_Core_BAO_Cache_Psr16 {
         $groups[] = 'descendant groups for an org';
       }
     }
+    $entitySettingExtensionStatus = $extensions->getStatus('nz.co.fuzion.entitysetting');
+    if ($multisiteExtensionStatus == $extensions::STATUS_INSTALLED) {
+      $extension_version = civicrm_api3('Extension', 'get', ['key' => 'nz.co.fuzion.entitysetting'])['values'][0]['version'];
+      if (version_compare($extension_version, '1.3', '<')) {
+        Civi::log()->warning(
+          'CRM_Core_BAO_Cache_PSR is deprecated for entity setting extension, you should upgrade to the latest version to avoid this warning, this code will be removed at the end of 2019',
+          ['civi.tag' => 'deprecated']
+        );
+        $groups[] = 'CiviCRM setting Spec';
+      }
+    }
     return $groups;
   }