From 12e16a64047ffb7093b19929255900ea217d2b51 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Mon, 17 Mar 2025 14:55:25 -0400 Subject: [PATCH] feat: use patch version if needed on update check (#1227) ## Summary by CodeRabbit - **New Features** - Enhanced version management so that update checks now prioritize combined version details obtained from patch data, ensuring more consistent and reliable version handling. --- .../emhttp/plugins/dynamix.my.servers/include/state.php | 7 +++++++ .../dynamix.plugin.manager/include/UnraidCheck.php | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php index fd5e3f30e..86bd921bf 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php @@ -95,6 +95,13 @@ class ServerState // echo "
" . json_encode($this->webguiGlobals, JSON_PRETTY_PRINT) . "
"; $this->var = $webguiGlobals['var']; + + // If we're on a patch, we need to use the combinedVersion to check for updates + 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']; + } + $this->nginxCfg = @parse_ini_file('/var/local/emhttp/nginx.ini') ?? []; $this->state = strtoupper(empty($this->var['regCheck']) ? $this->var['regTy'] : $this->var['regCheck']); diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php index e63862c37..de0b3bb26 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php @@ -115,7 +115,14 @@ class UnraidOsCheck $params = []; $params['branch'] = plugin('category', self::PLG_PATH, 'stable'); - $params['current_version'] = plugin('version', self::PLG_PATH) ?: _var($var,'version'); + // Get current version from patches.json if it exists, otherwise fall back to plugin version or var.ini + $patcherVersion = null; + if (file_exists('/tmp/Patcher/patches.json')) { + $patcherData = @json_decode(file_get_contents('/tmp/Patcher/patches.json'), true); + $patcherVersion = $patcherData['combinedVersion'] ?? null; + } + + $params['current_version'] = $patcherVersion ?: plugin('version', self::PLG_PATH) ?: _var($var, 'version'); if (_var($var,'regExp')) $params['update_exp'] = date('Y-m-d', _var($var,'regExp')*1); $defaultUrl = self::BASE_RELEASES_URL; // pass a param of altUrl to use the provided url instead of the default