From 5c095937d1a66d8b43d7403083a60d4a9292342b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 13 Sep 2021 08:48:26 +1200 Subject: [PATCH] Make managed entities functions protected The only affected universe place I found was https://github.com/veda-consulting-company/uk.co.vedaconsulting.gdpr/pull/294 Since putting the 'information gathering & storing' function on the constructor is tricky due to the singleton caching this means we are always working with a consistent entry point --- CRM/Core/ManagedEntities.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Core/ManagedEntities.php b/CRM/Core/ManagedEntities.php index 2f862483ec..70e72429f7 100644 --- a/CRM/Core/ManagedEntities.php +++ b/CRM/Core/ManagedEntities.php @@ -138,10 +138,8 @@ class CRM_Core_ManagedEntities { /** * For all enabled modules, add new entities, update * existing entities, and remove orphaned (stale) entities. - * - * @throws Exception */ - public function reconcileEnabledModules() { + protected function reconcileEnabledModules(): void { // Note: any thing currently declared is necessarily from // an active module -- because we got it from a hook! @@ -160,7 +158,7 @@ class CRM_Core_ManagedEntities { * * @param string $module */ - public function reconcileEnabledModule(string $module): void { + protected function reconcileEnabledModule(string $module): void { foreach ($this->getManagedEntitiesToUpdate(['module' => $module]) as $todo) { $dao = new CRM_Core_DAO_Managed(); $dao->module = $todo['module']; @@ -242,7 +240,7 @@ class CRM_Core_ManagedEntities { /** * For all disabled modules, disable any managed entities. */ - public function reconcileDisabledModules() { + protected function reconcileDisabledModules() { if (empty($this->moduleIndex[FALSE])) { return; } @@ -262,7 +260,7 @@ class CRM_Core_ManagedEntities { * Remove any orphaned (stale) entities that are linked to * unknown modules. */ - public function reconcileUnknownModules() { + protected function reconcileUnknownModules() { $knownModules = []; if (array_key_exists(0, $this->moduleIndex) && is_array($this->moduleIndex[0])) { $knownModules = array_merge($knownModules, array_keys($this->moduleIndex[0])); @@ -313,7 +311,7 @@ class CRM_Core_ManagedEntities { * @param array $todo * Entity specification (per hook_civicrm_managedEntities). */ - public function updateExistingEntity($dao, $todo) { + protected function updateExistingEntity($dao, $todo) { $policy = CRM_Utils_Array::value('update', $todo, 'always'); $doUpdate = ($policy === 'always'); -- 2.25.1