diff --git a/app/modules/module_shop/controllers/ModuleShopController.php b/app/modules/module_shop/controllers/ModuleShopController.php index e161b0b..dea7056 100644 --- a/app/modules/module_shop/controllers/ModuleShopController.php +++ b/app/modules/module_shop/controllers/ModuleShopController.php @@ -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); } diff --git a/app/modules/module_shop/services/ModuleShopService.php b/app/modules/module_shop/services/ModuleShopService.php index 33c6ac1..d7fcd88 100644 --- a/app/modules/module_shop/services/ModuleShopService.php +++ b/app/modules/module_shop/services/ModuleShopService.php @@ -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; diff --git a/app/modules/tag/manifest.json b/app/modules/tag/manifest.json index 87665ad..3967dd6 100644 --- a/app/modules/tag/manifest.json +++ b/app/modules/tag/manifest.json @@ -1,6 +1,6 @@ { "name": "Tags", - "version": "0.1", + "version": "0.2", "author": "ITGuild", "slug": "tag", "description": "Tags module", diff --git a/kernel/services/ModuleService.php b/kernel/services/ModuleService.php index 80b140c..79e023e 100644 --- a/kernel/services/ModuleService.php +++ b/kernel/services/ModuleService.php @@ -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');