brta archive module

This commit is contained in:
2024-10-08 17:06:14 +03:00
parent 381c6c059e
commit 77933cdd9e
56 changed files with 1591 additions and 15 deletions

View File

@ -55,8 +55,6 @@ class AdminThemeController extends ConsoleController
if (file_exists(ROOT_DIR . $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();

View File

@ -3,6 +3,7 @@
namespace kernel\console\controllers;
use kernel\console\ConsoleController;
use kernel\helpers\Debug;
use kernel\helpers\Files;
use kernel\helpers\Manifest;
use kernel\models\Option;
@ -75,4 +76,34 @@ class ModuleController extends ConsoleController
}
}
public function actionPackModule(): void
{
if (!isset($this->argv['path'])) {
throw new \Exception('Missing module path "--path" specified');
}
if (file_exists(ROOT_DIR . $this->argv['path'])) {
$moduleName = basename($this->argv['path']);
$tmpModuleDirFull = RESOURCES_DIR . '/tmp/ad/' . $moduleName . "/";
$fileHelper = new Files();
$fileHelper->copy_folder(APP_DIR . '/modules/' . $moduleName, $tmpModuleDirFull . 'app/');
$fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $moduleName, $tmpModuleDirFull . 'kernel/');
$this->out->r("Модуль собран в одну папку", 'green');
// $fileHelper->pack($zip, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.zip');
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.zip');
// $zip->addEmptyDir($moduleName);
// $zip->close();
// $this->out->r("zip закрыт", 'green');
$this->out->r("Архив создан", 'green');
}
}
}

View File

@ -24,5 +24,6 @@ App::$collector->group(["prefix" => "admin"], callback: function (RouteCollector
App::$collector->group(["prefix" => "module"], callback: function (RouteCollector $router){
App::$collector->console('install', [\kernel\console\controllers\ModuleController::class, 'actionInstallModule']);
App::$collector->console('uninstall', [\kernel\console\controllers\ModuleController::class, 'actionUninstallModule']);
App::$collector->console('pack', [\kernel\console\controllers\ModuleController::class, 'actionPackModule']);
});