From 159b3933fbe46648505888c83734bf97613287e0 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Mon, 2 Dec 2024 16:50:44 +0300 Subject: [PATCH] some fix --- kernel/services/ModuleService.php | 17 +++++++++++++++++ kernel/views/module/index.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/kernel/services/ModuleService.php b/kernel/services/ModuleService.php index dd2c7d4..6a8b01c 100644 --- a/kernel/services/ModuleService.php +++ b/kernel/services/ModuleService.php @@ -471,6 +471,23 @@ class ModuleService return false; } + public function isShopModule(string $slug): bool + { + if ($this->isServerAvailable()){ + $modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + + $modules_info = json_decode($modules_info->getBody()->getContents(), true); + $mod_info = $this->getModuleInfoBySlug($slug); + foreach ($modules_info as $mod) { + if ($mod['slug'] === $mod_info['slug']) { + return true; + } + } + } + + return false; + } + public function getKernelModules(): array { $modules_info = []; diff --git a/kernel/views/module/index.php b/kernel/views/module/index.php index 6114995..52c6bcb 100644 --- a/kernel/views/module/index.php +++ b/kernel/views/module/index.php @@ -54,7 +54,7 @@ $table->addAction(function ($row, $url) use ($moduleService) { }); $table->addAction(function ($row, $url) use ($moduleService){ - if (!$moduleService->isKernelModule($row['slug'])){ + if ($moduleService->isShopModule($row['slug'])){ if (!$moduleService->isLastVersion($row['slug'])) { $url = "$url/update/?slug=". $row['slug'];