diff --git a/application/Espo/Core/DataManager.php b/application/Espo/Core/DataManager.php index 5a893d97f5..e90ce1347e 100644 --- a/application/Espo/Core/DataManager.php +++ b/application/Espo/Core/DataManager.php @@ -117,6 +117,8 @@ class DataManager */ public function clearCache(): void { + $this->module->clearCache(); + $result = $this->fileManager->removeInDir($this->cachePath); if ($result != true) { diff --git a/application/Espo/Core/Utils/File/Unifier.php b/application/Espo/Core/Utils/File/Unifier.php index f00f5d6989..8cd766859d 100644 --- a/application/Espo/Core/Utils/File/Unifier.php +++ b/application/Espo/Core/Utils/File/Unifier.php @@ -199,10 +199,6 @@ class Unifier */ private function getModuleList(): array { - if (!isset($this->moduleList)) { - $this->moduleList = $this->module->getOrderedList(); - } - - return $this->moduleList; + return $this->module->getOrderedList(); } } diff --git a/application/Espo/Core/Utils/Module.php b/application/Espo/Core/Utils/Module.php index 5cce830d38..aab9b52569 100644 --- a/application/Espo/Core/Utils/Module.php +++ b/application/Espo/Core/Utils/Module.php @@ -188,6 +188,17 @@ class Module return $this->list; } + /** + * @todo Use event-dispatcher class (passed via constructor). + * `$this->clearCacheEventDispatcher->subscribe( ... );` + */ + public function clearCache(): void + { + $this->data = null; + $this->list = null; + $this->internalList = null; + } + private function loadData(): array { $data = [];