From: colemanw Date: Fri, 15 Sep 2023 13:36:11 +0000 (-0400) Subject: CiviCase - Optimize managed reconcile X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=57763debb5b27ea47ecc1e6e214d836570bc08ab;p=civicrm-core.git CiviCase - Optimize managed reconcile --- diff --git a/CRM/Case/ManagedEntities.php b/CRM/Case/ManagedEntities.php index 4f253e430e..6c6d3d1f83 100644 --- a/CRM/Case/ManagedEntities.php +++ b/CRM/Case/ManagedEntities.php @@ -58,12 +58,11 @@ class CRM_Case_ManagedEntities { * Get a list of managed activity-types by searching CiviCase XML files. * * @param \CRM_Case_XMLRepository $xmlRepo - * @param \CRM_Core_ManagedEntities $me * * @return array * @see CRM_Utils_Hook::managed */ - public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) { + public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo): array { $result = []; $validActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name'); @@ -102,12 +101,11 @@ class CRM_Case_ManagedEntities { * Get a list of managed relationship-types by searching CiviCase XML files. * * @param \CRM_Case_XMLRepository $xmlRepo - * @param \CRM_Core_ManagedEntities $me * * @return array * @see CRM_Utils_Hook::managed */ - public static function createManagedRelationshipTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) { + public static function createManagedRelationshipTypes(CRM_Case_XMLRepository $xmlRepo): array { $result = []; if (!isset(Civi::$statics[__CLASS__]['reltypes'])) { diff --git a/ext/civi_case/civi_case.php b/ext/civi_case/civi_case.php index 82665f72e3..d35d421086 100644 --- a/ext/civi_case/civi_case.php +++ b/ext/civi_case/civi_case.php @@ -7,10 +7,13 @@ use CRM_Case_ExtensionUtil as E; * Implements hook_civicrm_managed(). */ function civi_case_civicrm_managed(&$entities, $modules) { - // Don't optimize for $modules because the below functions delegate to other extensions - $entities = array_merge($entities, - CRM_Case_ManagedEntities::createManagedCaseTypes(), - CRM_Case_ManagedEntities::createManagedActivityTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton()), - CRM_Case_ManagedEntities::createManagedRelationshipTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton()) - ); + // Don't optimize for $modules because `createManagedCaseTypes` delegates to other extensions + $entities = array_merge($entities, CRM_Case_ManagedEntities::createManagedCaseTypes()); + // These functions always declare module = civicrm + if (!$modules || in_array('civicrm', $modules, TRUE)) { + $entities = array_merge($entities, + CRM_Case_ManagedEntities::createManagedActivityTypes(CRM_Case_XMLRepository::singleton()), + CRM_Case_ManagedEntities::createManagedRelationshipTypes(CRM_Case_XMLRepository::singleton()) + ); + } }