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::createSlug($model->name, ModuleShop::class); if ($model->save()) { return $model; } return false; } 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->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"); if ($model->save()) { return $model; } return false; } public function packModule($module): void { $tmpModuleDir = md5(time()); $authorSlug = Slug::createSlug($module->author); $nameSlug = Slug::createSlug($module->name); $tmpModuleDirFull = RESOURCES_DIR . '/tmp/modules/' . $tmpModuleDir . '/'; $fileHelper = new Files(); Debug::dd(APP_DIR . '/modules/' . $nameSlug); $fileHelper->copy_folder(APP_DIR . '/modules/' . $nameSlug, $tmpModuleDirFull . 'app/'); // $fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $nameSlug, $tmpModuleDirFull . 'kernel/'); $fileHelper->pack( $tmpModuleDirFull, RESOURCES_DIR . '/module_shop/' . $authorSlug . '/' . $module->slug . '/' . $module->version . '/' . $nameSlug . '.itguild' ); $fileHelper->recursiveRemoveDir($tmpModuleDirFull); } }