version fix

This commit is contained in:
2024-12-18 15:24:25 +03:00
parent aa913293ef
commit a0a99de862
6 changed files with 59 additions and 12 deletions

View File

@ -6,6 +6,7 @@ use kernel\helpers\Debug;
use kernel\helpers\Files;
use kernel\helpers\Manifest;
use kernel\helpers\RESTClient;
use kernel\helpers\Version;
use kernel\Request;
use ZipArchive;
@ -42,8 +43,12 @@ class KernelService
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
$kernel_info = $this->getKernelInfo();
$kernelVersion = Version::getIntVersionByString($kernel_info['version']);
foreach ($modules_info as $mod) {
if ($mod['slug'] === $kernel_info['slug'] && $mod['version'] === $kernel_info['version']) {
$modVersion = Version::getIntVersionByString($mod['version']);
if ($mod['slug'] === $kernel_info['slug'] && $modVersion <= $kernelVersion) {
return true;
}
}
@ -66,12 +71,12 @@ class KernelService
$zip->extractTo($tmpKernelDirFull);
$zip->close();
$this->files->recursiveRemoveKernelDir();
$this->files->copy_folder($tmpKernelDirFull . 'kernel' , ROOT_DIR . "/kernel");
$this->files->copyKernelFolder($tmpKernelDirFull . 'kernel' , ROOT_DIR . "/kernel");
foreach ($files as $file) {
if ($file === 'bootstrap') {
$this->files->recursiveRemoveDir(ROOT_DIR . '/bootstrap');
$this->files->copy_folder($tmpKernelDirFull . 'bootstrap' , ROOT_DIR . '/bootstrap');
$this->files->copyKernelFolder($tmpKernelDirFull . 'bootstrap' , ROOT_DIR . '/bootstrap');
}
copy($tmpKernelDirFull . $file , ROOT_DIR . '/' . $file);
}