recusive activate dependencies
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user