some fix
This commit is contained in:
parent
2470c5dba8
commit
3846da3f94
@ -50,11 +50,14 @@ class ModuleShopController extends AdminController
|
|||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$res = $zip->open(ROOT_DIR . $moduleShopForm->getItem('path_to_archive'));
|
$res = $zip->open(ROOT_DIR . $moduleShopForm->getItem('path_to_archive'));
|
||||||
if ($res === TRUE) {
|
if ($res === TRUE) {
|
||||||
|
if (!is_dir(RESOURCES_DIR . '/tmp/ms/')) {
|
||||||
|
mkdir(RESOURCES_DIR . '/tmp/ms/');
|
||||||
|
}
|
||||||
$tmpModuleShopDirFull = RESOURCES_DIR . '/tmp/ms/' . $tmpThemeDir . "/";
|
$tmpModuleShopDirFull = RESOURCES_DIR . '/tmp/ms/' . $tmpThemeDir . "/";
|
||||||
$zip->extractTo($tmpModuleShopDirFull);
|
$zip->extractTo($tmpModuleShopDirFull);
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
||||||
if (file_exists($tmpModuleShopDirFull . "/app/manifest.json")){
|
if (file_exists($tmpModuleShopDirFull . "app/manifest.json")){
|
||||||
$moduleInfo = $this->moduleShopService->getModuleInfo($tmpModuleShopDirFull . "app");
|
$moduleInfo = $this->moduleShopService->getModuleInfo($tmpModuleShopDirFull . "app");
|
||||||
$moduleShopForm->load($moduleInfo);
|
$moduleShopForm->load($moduleInfo);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ class ModuleShopService extends ModuleService
|
|||||||
$model->status = $form_model->getItem("status");
|
$model->status = $form_model->getItem("status");
|
||||||
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
||||||
$model->dependence = $form_model->getItem("dependence");
|
$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()) {
|
if ($model->save()) {
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
@ -32,16 +33,14 @@ class ModuleShopService extends ModuleService
|
|||||||
|
|
||||||
public function update(FormModel $form_model, ModuleShop $model): false|ModuleShop
|
public function update(FormModel $form_model, ModuleShop $model): false|ModuleShop
|
||||||
{
|
{
|
||||||
if ($model->name !== $form_model->getItem("name")) {
|
$model->name = $form_model->getItem("name");
|
||||||
$model->name = $form_model->getItem("name");
|
|
||||||
$model->slug = Slug::createSlug($model->name, ModuleShop::class);
|
|
||||||
}
|
|
||||||
$model->version = $form_model->getItem("version");
|
$model->version = $form_model->getItem("version");
|
||||||
$model->description = $form_model->getItem("description");
|
$model->description = $form_model->getItem("description");
|
||||||
$model->author = $form_model->getItem("author");
|
$model->author = $form_model->getItem("author");
|
||||||
$model->status = $form_model->getItem("status");
|
$model->status = $form_model->getItem("status");
|
||||||
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
||||||
$model->dependence = $form_model->getItem("dependence");
|
$model->dependence = $form_model->getItem("dependence");
|
||||||
|
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
|
||||||
|
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
return $model;
|
return $model;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Tags",
|
"name": "Tags",
|
||||||
"version": "0.1",
|
"version": "0.2",
|
||||||
"author": "ITGuild",
|
"author": "ITGuild",
|
||||||
"slug": "tag",
|
"slug": "tag",
|
||||||
"description": "Tags module",
|
"description": "Tags module",
|
||||||
|
@ -346,7 +346,7 @@ class ModuleService
|
|||||||
$fileHelper->copy_folder(APP_DIR . '/modules/' . $moduleName, $tmpModuleDirFull . 'app/');
|
$fileHelper->copy_folder(APP_DIR . '/modules/' . $moduleName, $tmpModuleDirFull . 'app/');
|
||||||
$fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $moduleName, $tmpModuleDirFull . 'kernel/');
|
$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);
|
mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true);
|
||||||
}
|
}
|
||||||
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.itguild');
|
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.itguild');
|
||||||
|
Loading…
Reference in New Issue
Block a user