kernel update

This commit is contained in:
Билай Станислав 2024-10-24 11:53:17 +03:00
parent 3846da3f94
commit 45d51c7119
4 changed files with 25 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "Tags", "name": "Tags",
"version": "0.2", "version": "0.3",
"author": "ITGuild", "author": "ITGuild",
"slug": "tag", "slug": "tag",
"description": "Tags module", "description": "Tags module",

View File

@ -41,6 +41,14 @@ class KernelController extends ConsoleController
$this->out->r("/bootstrap не найден", 'red'); $this->out->r("/bootstrap не найден", 'red');
} }
if (file_exists(ROOT_DIR . '/bootstrap.php')) {
$tmpBootstrapPhpDirFull = RESOURCES_DIR . '/tmp/ad/kernel/bootstrap.php';
copy(ROOT_DIR . '/bootstrap.php', $tmpBootstrapPhpDirFull);
$this->out->r("/bootstrap.php скопирован во временную папку", 'green');
} else {
$this->out->r("/bootstrap.php не найден", 'red');
}
if (file_exists(ROOT_DIR . '/.env.example')) { if (file_exists(ROOT_DIR . '/.env.example')) {
$tmpEnvDirFull = RESOURCES_DIR . '/tmp/ad/kernel/env.example'; $tmpEnvDirFull = RESOURCES_DIR . '/tmp/ad/kernel/env.example';
copy(ROOT_DIR . '/.env.example', $tmpEnvDirFull); copy(ROOT_DIR . '/.env.example', $tmpEnvDirFull);
@ -88,6 +96,7 @@ class KernelController extends ConsoleController
if (isset($this->argv['bootstrap'])) { if (isset($this->argv['bootstrap'])) {
$this->files->recursiveRemoveDir(ROOT_DIR . '/bootstrap'); $this->files->recursiveRemoveDir(ROOT_DIR . '/bootstrap');
$this->files->copy_folder($tmpKernelDirFull . 'bootstrap' , ROOT_DIR . '/bootstrap'); $this->files->copy_folder($tmpKernelDirFull . 'bootstrap' , ROOT_DIR . '/bootstrap');
copy($tmpKernelDirFull . '/bootstrap.php' , ROOT_DIR . '/bootstrap.php');
} }
if (isset($this->argv['env'])) { if (isset($this->argv['env'])) {

View File

@ -24,7 +24,11 @@ class ModuleController extends ConsoleController
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$moduleService = new ModuleService(); $moduleService = new ModuleService();
$moduleService->installModule($this->argv['path']); if ($moduleService->installModule($this->argv['path'])) {
$this->out->r("Модуль установлен", 'green');
} else {
$this->out->r("Ошибка установки модуля", 'red');
}
} else { } else {
$this->out->r("Модуль не найден", 'red'); $this->out->r("Модуль не найден", 'red');
} }
@ -42,6 +46,7 @@ class ModuleController extends ConsoleController
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$moduleService = new ModuleService(); $moduleService = new ModuleService();
$moduleService->uninstallModule($this->argv['path']); $moduleService->uninstallModule($this->argv['path']);
$this->out->r("Модуль удален", 'green');
} else { } else {
$this->out->r("Модуль не найден", 'red'); $this->out->r("Модуль не найден", 'red');
} }
@ -59,6 +64,7 @@ class ModuleController extends ConsoleController
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$moduleService = new ModuleService(); $moduleService = new ModuleService();
$moduleService->packModule($this->argv['path']); $moduleService->packModule($this->argv['path']);
$this->out->r("Модуль заархивирован", 'green');
} else { } else {
$this->out->r("Модуль не найден", 'red'); $this->out->r("Модуль не найден", 'red');
} }
@ -74,7 +80,13 @@ class ModuleController extends ConsoleController
} }
if (file_exists(ROOT_DIR . $this->argv['path'])) { if (file_exists(ROOT_DIR . $this->argv['path'])) {
$moduleService = new ModuleService(); $moduleService = new ModuleService();
$moduleService->updateModule($this->argv['path']); if ($moduleService->updateModule($this->argv['path'])) {
$this->out->r("Модуль обновлен", 'green');
} else {
$this->out->r("Ошибка обновления модуля", 'red');
}
} else {
$this->out->r("Модуль не найден", 'red');
} }
} }

View File

@ -306,7 +306,6 @@ class ModuleService
} }
$fileHelper->recursiveRemoveDir($tmpModuleDirFull); $fileHelper->recursiveRemoveDir($tmpModuleDirFull);
var_dump($tmpModuleDirFull);
return true; return true;
} }
@ -349,7 +348,7 @@ class ModuleService
if (!is_dir(RESOURCES_DIR . '/tmp/modules')) { if (!is_dir(RESOURCES_DIR . '/tmp/modules')) {
mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true); mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true);
} }
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.itguild'); $fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.igm');
$fileHelper->recursiveRemoveDir($tmpModuleDirFull); $fileHelper->recursiveRemoveDir($tmpModuleDirFull);
} }