kernel update to v0.1.5

This commit is contained in:
2025-01-24 11:33:08 +03:00
parent 4d7a2fbdec
commit 530908568c
5 changed files with 87 additions and 19 deletions

View File

@ -21,6 +21,7 @@ class ModuleService
protected null|bool $serverAvailable = null;
public ModuleShopService $moduleShopService;
public function __construct()
{
$this->moduleShopService = new ModuleShopService();
@ -601,11 +602,41 @@ class ModuleService
{
$data = file_get_contents($templatePath);
foreach ($params as $key => $param){
foreach ($params as $key => $param) {
$data = str_replace("{" . $key . "}", $param, $data);
}
file_put_contents($filePath, $data);
}
/**
* @throws GuzzleException
*/
public function recursiveActivateDependencies(array $dependencies): bool
{
$notActiveDependencies = [];
foreach ($dependencies as $depend) {
if (!$this->isInstall($depend)) {
$this->moduleShopService->installModule($depend);
if (!$this->setActiveModule($depend)) {
$notActiveDependencies[] = $depend;
}
} else {
if (!$this->isActive($depend)) {
if (!$this->setActiveModule($depend)) {
$notActiveDependencies[] = $depend;
}
}
}
}
if ($notActiveDependencies) {
if (!$this->recursiveActivateDependencies($notActiveDependencies)) {
return false;
}
}
return true;
}
}