From: colemanw Date: Mon, 5 Feb 2024 19:25:37 +0000 (-0500) Subject: AngularManager - Simplify caching X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2653f0c7b6e898d99f4b29ac1f3e279bc4bbefe8;p=civicrm-core.git AngularManager - Simplify caching In 604cca72 the cache was split into smaller pieces in an attempt to fix some failing tests. It turned out those fails for other reasons so there's no need to have > 1 cache for angularModules. Fixes https://lab.civicrm.org/dev/core/-/issues/4969 --- diff --git a/Civi/Angular/Manager.php b/Civi/Angular/Manager.php index 37e115c7b7..ee5c65c463 100644 --- a/Civi/Angular/Manager.php +++ b/Civi/Angular/Manager.php @@ -77,10 +77,9 @@ class Manager { * List of settings to preload. */ public function getModules() { - $moduleNames = $this->cache->get('moduleNames'); - $angularModules = []; + $angularModules = $this->cache->get('angularModules') ?? []; // Cache not set, fetch fresh list of modules and store in cache - if (!$moduleNames) { + if (!$angularModules) { // Load all modules from CiviCRM core $files = (array) glob(\Civi::paths()->getPath('[civicrm.root]/ang/*.ang.php')); foreach ($files as $file) { @@ -113,16 +112,7 @@ class Manager { } } $angularModules = $this->resolvePatterns($angularModules); - $this->cache->set('moduleNames', array_keys($angularModules)); - foreach ($angularModules as $moduleName => $moduleInfo) { - $this->cache->set("module $moduleName", $moduleInfo); - } - } - // Rehydrate modules from cache - else { - foreach ($moduleNames as $moduleName) { - $angularModules[$moduleName] = $this->cache->get("module $moduleName"); - } + $this->cache->set('angularModules', $angularModules); } return $angularModules;