fix: patch version override logic incorrect (#1275)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved the system’s version update mechanism so that updates are
applied only when the current system version matches the expected
version. This enhancement ensures more consistent and reliable version
checks during the update process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Eli Bosley
2025-03-26 17:57:30 -04:00
committed by GitHub
parent b0099421f3
commit 0bcfb47bbc
2 changed files with 14 additions and 4 deletions

View File

@@ -96,10 +96,17 @@ class ServerState
$this->var = $webguiGlobals['var'];
// If we're on a patch, we need to use the combinedVersion to check for updates
$patcherVersion = null;
if (file_exists('/tmp/Patcher/patches.json')) {
$patchJson = @json_decode(@file_get_contents('/tmp/Patcher/patches.json'), true) ?: [];
$this->var['version'] = $patchJson['combinedVersion'] ?? $this->var['version'];
$patcherData = @json_decode(file_get_contents('/tmp/Patcher/patches.json'), true);
$unraidVersionInfo = parse_ini_file('/etc/unraid-version');
if ($patcherData['unraidVersion'] === $unraidVersionInfo['version']) {
$patcherVersion = $patcherData['combinedVersion'] ?? null;
}
}
// If we're on a patch, we need to use the combinedVersion to check for updates
if ($patcherVersion) {
$this->var['version'] = $patcherVersion;
}
$this->nginxCfg = @parse_ini_file('/var/local/emhttp/nginx.ini') ?? [];

View File

@@ -119,7 +119,10 @@ class UnraidOsCheck
$patcherVersion = null;
if (file_exists('/tmp/Patcher/patches.json')) {
$patcherData = @json_decode(file_get_contents('/tmp/Patcher/patches.json'), true);
$patcherVersion = $patcherData['combinedVersion'] ?? null;
$unraidVersionInfo = parse_ini_file('/etc/unraid-version');
if ($patcherData['unraidVersion'] === $unraidVersionInfo['version']) {
$patcherVersion = $patcherData['combinedVersion'] ?? null;
}
}
$params['current_version'] = $patcherVersion ?: plugin('version', self::PLG_PATH) ?: _var($var, 'version');