From d071c8b4039e0f6b409958bdb43ab34fcebd7151 Mon Sep 17 00:00:00 2001 From: VVelox Date: Tue, 11 Jun 2019 07:52:42 -0500 Subject: [PATCH] sort arrays before storing them in a component (#10329) --- includes/polling/applications/portactivity.inc.php | 3 +++ includes/polling/applications/postgres.inc.php | 3 +++ includes/polling/applications/zfs.inc.php | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/polling/applications/portactivity.inc.php b/includes/polling/applications/portactivity.inc.php index 264b416c5f..d5e0199117 100644 --- a/includes/polling/applications/portactivity.inc.php +++ b/includes/polling/applications/portactivity.inc.php @@ -149,6 +149,9 @@ if (empty($ports_keys)) { $portsc = $component->createComponent($device_id, 'portsactivity'); } + // Make sure we don't readd it, just in a different order. + sort($ports_keys); + $id = $component->getFirstComponentID($portsc); $portsc[$id]['label'] = 'Portsactivity'; $portsc[$id]['ports'] = json_encode($ports_keys); diff --git a/includes/polling/applications/postgres.inc.php b/includes/polling/applications/postgres.inc.php index 4cc35b784a..e182209692 100644 --- a/includes/polling/applications/postgres.inc.php +++ b/includes/polling/applications/postgres.inc.php @@ -128,6 +128,9 @@ if (empty($found_dbs)) { $pgc = $component->createComponent($device_id, 'postgres'); } + // Make sure we don't readd it, just in a different order. + sort($found_dbs); + $id = $component->getFirstComponentID($pgc); $pgc[$id]['label'] = 'Postgres'; $pgc[$id]['databases'] = json_encode($found_dbs); diff --git a/includes/polling/applications/zfs.inc.php b/includes/polling/applications/zfs.inc.php index e1fc12cd64..6b5b4e4be2 100644 --- a/includes/polling/applications/zfs.inc.php +++ b/includes/polling/applications/zfs.inc.php @@ -9,7 +9,7 @@ $app_id = $app['app_id']; echo $name; -// Is set to false later if missing keys are found. +// Is set to false later if missing keys are found. $not_legacy=1; try { @@ -205,6 +205,9 @@ if (empty($pools)) { $zfsc = $component->createComponent($device_id, 'zfs'); } + // Make sure we don't readd it, just in a different order. + sort($pools); + $id = $component->getFirstComponentID($zfsc); $zfsc[$id]['label'] = 'ZFS'; $zfsc[$id]['pools'] = json_encode($pools);