Update handling of submetric values in index.php
Refactor condition to set submetric value based on fallback.
This commit is contained in:
parent
8d0959b21c
commit
81255d0b27
@ -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 (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(!isset($submetric['fallback']['maxage']) || time() < ($oldconfig[$key]['submetrics'][$subkey]['time'] + $submetric['fallback']['maxage'])) {
|
||||||
if($submetric['fallback']['type'] == 'previous') {
|
if($submetric['fallback']['type'] == 'previous') {
|
||||||
$submetric['value'] = $oldconfig[$key]['submetrics'][$subkey]['value'];
|
$submetric['value'] = $oldconfig[$key]['submetrics'][$subkey]['value'];
|
||||||
|
Loading…
Reference in New Issue
Block a user