This commit is contained in:
2025-08-01 15:06:16 +03:00
parent b86b8ff923
commit 2b02ca4471
4 changed files with 17 additions and 11 deletions

View File

@@ -13,4 +13,9 @@ class Version
3 => intval($version),
};
}
public static function compare($current, $version): bool|int
{
return version_compare($current, $version);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "Kernel",
"version": "0.1.10",
"version": "0.1.11",
"author": "ITGuild",
"slug": "kernel",
"type": "kernel",

View File

@@ -44,15 +44,14 @@ class KernelService
$kernel_info = $this->getKernelInfo();
$kernelVersion = Version::getIntVersionByString($kernel_info['version']);
foreach ($modules_info as $mod) {
$modVersion = Version::getIntVersionByString($mod['version']);
if ($mod['slug'] === $kernel_info['slug'] && $modVersion <= $kernelVersion) {
if ($mod['slug'] === $kernel_info['slug'] ) {
if (Version::compare($kernel_info['version'], $mod['version']) >= 0){
return true;
}
}
}
}
return false;
}

View File

@@ -185,7 +185,7 @@ class ModuleService
if ($module_paths) {
$path = json_decode($module_paths->value);
foreach ($path->paths as $p) {
if (!is_dir(getConst($p))){
if (!is_dir(getConst($p))) {
$old_mask = umask(0);
mkdir(getConst($p), permissions: 0775, recursive: true);
umask($old_mask);
@@ -492,14 +492,16 @@ class ModuleService
$mod_info = $this->getModuleInfoBySlug($slug);
$currentVersion = Version::getIntVersionByString($mod_info['version']);
$currentVersion = $mod_info['version'];
foreach ($modules_info as $mod) {
$modVersion = Version::getIntVersionByString($mod['version']);
if ($mod['slug'] === $mod_info['slug'] && $modVersion <= $currentVersion) {
$modVersion = $mod['version'];
if ($mod['slug'] === $mod_info['slug']) {
if (Version::compare($currentVersion, $modVersion) >= 0) {
return true;
}
}
}
}
return false;
}