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

@ -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');
}
}
}