From e4c3655d92c7fd3083bca0d82f94fc5175ef26d2 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Mon, 28 Oct 2024 11:03:30 +0300 Subject: [PATCH] kernel update --- kernel/helpers/Files.php | 4 ++-- kernel/modules/post/manifest.json | 2 +- kernel/services/ModuleService.php | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/kernel/helpers/Files.php b/kernel/helpers/Files.php index 4cd710a..d140f2c 100644 --- a/kernel/helpers/Files.php +++ b/kernel/helpers/Files.php @@ -82,11 +82,11 @@ class Files if(is_dir($include)) { if ($include->getFilename() === 'app_modules') continue; - $tmpFolder = $folder . '/' . $include->getFilename() . '/'; + $tmpFolder = $folder . '/' . $include->getFilename(); $this->recursiveAddFile($zip, $include, $tmpFolder); } if (is_file($include)) { - $zip->addFile($include->getPathName(), $folder . $include->getFilename()); + $zip->addFile($include->getPathName(), $folder . "/" . $include->getFilename()); } } } diff --git a/kernel/modules/post/manifest.json b/kernel/modules/post/manifest.json index 2de6805..7ff222b 100644 --- a/kernel/modules/post/manifest.json +++ b/kernel/modules/post/manifest.json @@ -1,6 +1,6 @@ { "name": "Post", - "version": "0.1", + "version": "0.2", "author": "ITGuild", "slug": "post", "description": "Post module", diff --git a/kernel/services/ModuleService.php b/kernel/services/ModuleService.php index bf65403..646f449 100644 --- a/kernel/services/ModuleService.php +++ b/kernel/services/ModuleService.php @@ -342,15 +342,20 @@ class ModuleService $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/'); + $fileHelper->copy_folder(ROOT_DIR . $path, $tmpModuleDirFull . 'app/'); + if (file_exists(KERNEL_APP_MODULES_DIR . '/' . $moduleName)){ + $fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $moduleName, $tmpModuleDirFull . 'kernel/'); + } + else { + mkdir($tmpModuleDirFull . 'kernel/'); + } if (!is_dir(RESOURCES_DIR . '/tmp/modules')) { mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true); } $fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.igm'); - $fileHelper->recursiveRemoveDir($tmpModuleDirFull); + //$fileHelper->recursiveRemoveDir($tmpModuleDirFull); } /**