theme uninstall fix

This commit is contained in:
Билай Станислав 2024-09-12 12:56:10 +03:00
parent d7851a4160
commit 7758dd2925

View File

@ -5,6 +5,8 @@ namespace kernel\console\controllers;
use kernel\console\ConsoleController; use kernel\console\ConsoleController;
use kernel\helpers\Files; use kernel\helpers\Files;
use kernel\helpers\Manifest; use kernel\helpers\Manifest;
use kernel\models\Option;
use kernel\services\AdminThemeService;
use ZipArchive; use ZipArchive;
class AdminThemeController extends ConsoleController class AdminThemeController extends ConsoleController
@ -52,6 +54,15 @@ class AdminThemeController extends ConsoleController
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$themeName = basename($this->argv['path']); $themeName = basename($this->argv['path']);
$active_admin_theme = Option::where("key", "active_admin_theme")->first();
var_dump($active_admin_theme->value);
var_dump(ROOT_DIR . $this->argv['path']);
if ($active_admin_theme->value === ROOT_DIR . $this->argv['path']) {
$this->out->r("Меняем тему на базовую", 'green');
$adminThemeService = new AdminThemeService();
$adminThemeService->setActiveAdminTheme(KERNEL_ADMIN_THEMES_DIR . '/default');
$this->out->r("Тема изменена", 'green');
}
$fileHelper = new Files(); $fileHelper = new Files();
$fileHelper->recursiveRemoveDir(ROOT_DIR . $this->argv['path']); $fileHelper->recursiveRemoveDir(ROOT_DIR . $this->argv['path']);
$fileHelper->recursiveRemoveDir(RESOURCES_DIR . '/' . $themeName); $fileHelper->recursiveRemoveDir(RESOURCES_DIR . '/' . $themeName);