diff --git a/application/Espo/Core/Utils/Client/DevModeJsFileListProvider.php b/application/Espo/Core/Utils/Client/DevModeJsFileListProvider.php new file mode 100644 index 0000000000..f383177875 --- /dev/null +++ b/application/Espo/Core/Utils/Client/DevModeJsFileListProvider.php @@ -0,0 +1,91 @@ +fileManager = $fileManager; + } + + /** + * @return string[] + */ + public function get(): array + { + $list = []; + + $items = json_decode($this->fileManager->getContents(self::LIBS_FILE)); + + foreach ($items as $item) { + if (!($item->bundle ?? false)) { + continue; + } + + $files = $item->files ?? null; + + if ($files !== null) { + $list = array_merge( + $list, + $this->getLibFileListFromItems($files) + ); + + continue; + } + + $list[] = $item->src; + } + + return $list; + } + + private function getLibFileListFromItems(array $items): array + { + $list = []; + + foreach ($items as $item) { + $list[] = $item->src; + } + + return $list; + } +} diff --git a/application/Espo/Core/Utils/ClientManager.php b/application/Espo/Core/Utils/ClientManager.php index acef1a9706..65fecce178 100644 --- a/application/Espo/Core/Utils/ClientManager.php +++ b/application/Espo/Core/Utils/ClientManager.php @@ -31,6 +31,7 @@ namespace Espo\Core\Utils; use Espo\Core\{ Utils\File\Manager as FileManager, + Utils\Client\DevModeJsFileListProvider, }; /** @@ -52,20 +53,22 @@ class ClientManager private $basePath = ''; - private const LIBS_FILE = 'frontend/libs.json'; - private $libsConfigPath = 'client/cfg/libs.json'; + private $devModeJsFileListProvider; + public function __construct( Config $config, ThemeManager $themeManager, Metadata $metadata, - FileManager $fileManager + FileManager $fileManager, + DevModeJsFileListProvider $devModeJsFileListProvider ) { $this->config = $config; $this->themeManager = $themeManager; $this->metadata = $metadata; $this->fileManager = $fileManager; + $this->devModeJsFileListProvider = $devModeJsFileListProvider; } public function setBasePath(string $basePath): void @@ -220,37 +223,6 @@ class ClientManager */ private function getDeveloperModeBundleLibFileList(): array { - $list = []; - - $items = json_decode($this->fileManager->getContents(self::LIBS_FILE)); - - foreach ($items as $item) { - if (!($item->bundle ?? false)) { - continue; - } - - $files = $item->files ?? null; - - if ($files !== null) { - $list = array_merge($list, $this->getLibFileListFromItems($files)); - - continue; - } - - $list[] = $item->src; - } - - return $list; - } - - private function getLibFileListFromItems(array $items): array - { - $list = []; - - foreach ($items as $item) { - $list[] = $item->src; - } - - return $list; + return $this->devModeJsFileListProvider->get(); } } diff --git a/install/core/Utils.php b/install/core/Utils.php index 7dac7e94aa..2f2f831770 100644 --- a/install/core/Utils.php +++ b/install/core/Utils.php @@ -31,7 +31,7 @@ class Utils { static public $actionPath = 'install/core/actions'; - static public function checkActionExists($actionName) + static public function checkActionExists(string $actionName): bool { return in_array($actionName, [ 'saveSettings', @@ -49,9 +49,7 @@ class Utils 'step2', 'step3', 'step4', - 'step5' + 'step5', ]); - - return false; } } diff --git a/install/core/tpl/index.tpl b/install/core/tpl/index.tpl index be00b24cf4..1a9cbb09ca 100644 --- a/install/core/tpl/index.tpl +++ b/install/core/tpl/index.tpl @@ -6,14 +6,22 @@ + {if $isBuild} + {else} + {foreach from=$libFileList item=file} + + {/foreach} + {/if} +
+