- Pre-Init the $options array.

In some scenarios $options was already set with a previous filter.
- Remove RRD file checking, test for existance of components instead.
This commit is contained in:
Aaron Daniels
2016-02-23 16:52:37 +10:00
parent 1a905f2a1a
commit f18fa9e455
2 changed files with 80 additions and 86 deletions

View File

@@ -87,9 +87,14 @@ if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['
$menu_options['vlans'] = 'VLANs';
}
// Are there any CBQoS rrd's for this ifIndex?
$cbqos = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
if (!empty($cbqos)) {
// Are there any CBQoS components for this device?
require_once "../includes/component.php";
$component = new component();
$options = array(); // Re-init array in case it has been declared previously.
$options['filter']['type'] = array('=','Cisco-CBQOS');
$components = $component->getComponents($device['device_id'],$options);
$components = $components[$device['device_id']]; // We only care about our device id.
if (count($components) > 0) {
$menu_options['cbqos'] = 'CBQoS';
}

View File

@@ -41,16 +41,6 @@ function find_child($components,$parent,$level) {
}
}
$rrdarr = glob($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-cbqos-*.rrd');
if (!empty($rrdarr)) {
require_once "../includes/component.php";
$component = new component();
$options['filter']['type'] = array('=','Cisco-CBQOS');
$components = $component->getComponents($device['device_id'],$options);
// We only care about our device id.
$components = $components[$device['device_id']];
if (!isset($vars['policy'])) {
// not set, find the first parent and use it.
foreach ($components as $id => $array) {
@@ -127,4 +117,3 @@ if (!empty($rrdarr)) {
echo "</div>\n\n";
}
}
}