Try to fix some of the Component code (#9888)

https://community.librenms.org/t/devices-list-stuck-at-loading/7396
This commit is contained in:
Tony Murray
2019-03-01 08:13:32 -06:00
committed by GitHub
parent 49f01970c5
commit 7c4a0c7244

View File

@@ -154,16 +154,17 @@ class Component
// Populate our reserved fields into the Array, these cant be used as user attributes.
foreach ($COMPONENTS as $COMPONENT) {
$component_device_id = (int)$COMPONENT['device_id'];
foreach ($this->reserved as $k => $v) {
$RESULT[$COMPONENT['device_id']][$COMPONENT['id']][$k] = $COMPONENT[$k];
$RESULT[$component_device_id][$COMPONENT['id']][$k] = $COMPONENT[$k];
}
// Sort each component array so the attributes are in order.
if (is_array($RESULT[$RESULT[$COMPONENT['device_id']][$COMPONENT['id']]])) {
ksort($RESULT[$RESULT[$COMPONENT['device_id']][$COMPONENT['id']]]);
if (is_array($RESULT[$RESULT[$component_device_id][$COMPONENT['id']]])) {
ksort($RESULT[$RESULT[$component_device_id][$COMPONENT['id']]]);
}
if (is_array($RESULT[$RESULT[$COMPONENT['device_id']]])) {
ksort($RESULT[$RESULT[$COMPONENT['device_id']]]);
if (is_array($RESULT[$RESULT[$component_device_id]])) {
ksort($RESULT[$RESULT[$component_device_id]]);
}
}