kernel update to v0.1.5
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace kernel\services;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Josantonius\Session\Facades\Session;
|
||||
use kernel\Flash;
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\helpers\Files;
|
||||
@ -22,6 +23,7 @@ class ThemeService
|
||||
|
||||
protected ModuleShopService $moduleShopService;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->option = new Option();
|
||||
@ -58,7 +60,6 @@ class ThemeService
|
||||
return $this->active_theme;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $theme
|
||||
* @return bool
|
||||
@ -69,27 +70,24 @@ class ThemeService
|
||||
$activeTheme = $this->option::where("key", "active_theme")->first();
|
||||
|
||||
$themeInfo = $this->getThemeInfo(getConst($theme));
|
||||
if (isset($themeInfo['dependence'])) {
|
||||
$dependence_array = explode(',', $themeInfo['dependence']);
|
||||
foreach ($dependence_array as $depend) {
|
||||
if (!$this->moduleService->isInstall($depend)) {
|
||||
if ($this->moduleService->isShopModule($depend)) {
|
||||
$this->moduleShopService->installModule($depend);
|
||||
} else {
|
||||
Flash::setMessage("error", "Модуль не найден в IT Guild Framework Shop.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!$this->moduleService->isActive($depend)) {
|
||||
$this->moduleService->setActiveModule($depend);
|
||||
}
|
||||
$dependenceArray = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/get_all_dependencies/' . $themeInfo['slug']);
|
||||
$dependenceArray = json_decode($dependenceArray->getBody()->getContents(), true);
|
||||
|
||||
foreach ($dependenceArray as $depend) {
|
||||
if (!$this->moduleService->isInstall($depend)) {
|
||||
if (!$this->moduleShopService->existsInModuleShop($depend)) {
|
||||
Flash::setMessage('error', "Модуль $depend не найден в IT Guild Framework Shop.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->moduleService->recursiveActivateDependencies($dependenceArray)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$activeTheme->value = getConst($theme);
|
||||
$activeTheme->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user