From 81255d0b274490cc07fc8e5a44be944cb21970ae Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 4 Jun 2024 19:39:08 +0200 Subject: [PATCH] Update handling of submetric values in index.php Refactor condition to set submetric value based on fallback. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 52b826c..98ec797 100644 --- a/index.php +++ b/index.php @@ -77,7 +77,7 @@ if(php_sapi_name() == 'cli' || $_SERVER["REQUEST_URI"] == '/metrics') { if (is_bool($submetric['value'])) $submetric['value'] = $submetric['value'] ? 1 : 0; - if(!empty($oldconfig) && empty($submetric['value']) && (isset($submetric['fallback']) && !empty($submetric['fallback']))) { + if(!empty($oldconfig) && !isset($submetric['value']) && (isset($submetric['fallback']) && !empty($submetric['fallback']))) { if(!isset($submetric['fallback']['maxage']) || time() < ($oldconfig[$key]['submetrics'][$subkey]['time'] + $submetric['fallback']['maxage'])) { if($submetric['fallback']['type'] == 'previous') { $submetric['value'] = $oldconfig[$key]['submetrics'][$subkey]['value'];