theme dependence

This commit is contained in:
2025-01-21 16:41:48 +03:00
parent f421e0c649
commit 11c99be0f6
26 changed files with 96 additions and 908 deletions

View File

@ -3,6 +3,7 @@
namespace kernel\services;
use DirectoryIterator;
use GuzzleHttp\Exception\GuzzleException;
use kernel\EntityRelation;
use kernel\Flash;
use kernel\helpers\Debug;
@ -19,6 +20,12 @@ class ModuleService
protected null|bool $serverAvailable = null;
public ModuleShopService $moduleShopService;
public function __construct()
{
$this->moduleShopService = new ModuleShopService();
}
/**
* @param string $module
* @return false|array|string
@ -458,12 +465,13 @@ class ModuleService
return false;
}
/**
* @throws GuzzleException
*/
public function isLastVersion(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);
$modules_info = $this->moduleShopService->getGroupedBySlugModules();
$mod_info = $this->getModuleInfoBySlug($slug);
@ -491,16 +499,18 @@ class ModuleService
return false;
}
/**
* @throws GuzzleException
*/
public function isShopModule(string $slug): bool
{
if ($this->isServerAvailable()) {
$modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
$modules_info = $this->moduleShopService->getGroupedBySlugModules();
if (!$this->issetModuleShopToken()) {
return false;
}
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
if (isset($modules_info)) {
$mod_info = $this->getModuleInfoBySlug($slug);
foreach ($modules_info as $mod) {