This commit is contained in:
Билай Станислав 2024-10-23 17:06:10 +03:00
parent 2470c5dba8
commit 3846da3f94
4 changed files with 10 additions and 8 deletions

View File

@ -50,11 +50,14 @@ class ModuleShopController extends AdminController
$zip = new ZipArchive;
$res = $zip->open(ROOT_DIR . $moduleShopForm->getItem('path_to_archive'));
if ($res === TRUE) {
if (!is_dir(RESOURCES_DIR . '/tmp/ms/')) {
mkdir(RESOURCES_DIR . '/tmp/ms/');
}
$tmpModuleShopDirFull = RESOURCES_DIR . '/tmp/ms/' . $tmpThemeDir . "/";
$zip->extractTo($tmpModuleShopDirFull);
$zip->close();
if (file_exists($tmpModuleShopDirFull . "/app/manifest.json")){
if (file_exists($tmpModuleShopDirFull . "app/manifest.json")){
$moduleInfo = $this->moduleShopService->getModuleInfo($tmpModuleShopDirFull . "app");
$moduleShopForm->load($moduleInfo);
}

View File

@ -22,7 +22,8 @@ class ModuleShopService extends ModuleService
$model->status = $form_model->getItem("status");
$model->path_to_archive = $form_model->getItem("path_to_archive");
$model->dependence = $form_model->getItem("dependence");
$model->slug = Slug::createSlug($model->name, ModuleShop::class);
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
if ($model->save()) {
return $model;
}
@ -32,16 +33,14 @@ class ModuleShopService extends ModuleService
public function update(FormModel $form_model, ModuleShop $model): false|ModuleShop
{
if ($model->name !== $form_model->getItem("name")) {
$model->name = $form_model->getItem("name");
$model->slug = Slug::createSlug($model->name, ModuleShop::class);
}
$model->name = $form_model->getItem("name");
$model->version = $form_model->getItem("version");
$model->description = $form_model->getItem("description");
$model->author = $form_model->getItem("author");
$model->status = $form_model->getItem("status");
$model->path_to_archive = $form_model->getItem("path_to_archive");
$model->dependence = $form_model->getItem("dependence");
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
if ($model->save()) {
return $model;

View File

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

View File

@ -346,7 +346,7 @@ class ModuleService
$fileHelper->copy_folder(APP_DIR . '/modules/' . $moduleName, $tmpModuleDirFull . 'app/');
$fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $moduleName, $tmpModuleDirFull . 'kernel/');
if (!is_dir(RESOURCES_DIR . '/tmp/module')) {
if (!is_dir(RESOURCES_DIR . '/tmp/modules')) {
mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true);
}
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.itguild');