From 1ee481ff6ebd8163bc9536d88c7a43f69313cb90 Mon Sep 17 00:00:00 2001 From: Eldon Koyle Date: Thu, 3 Dec 2015 09:40:30 -0700 Subject: [PATCH] Rename option to extended_port_metrics --- includes/defaults.inc.php | 2 +- includes/polling/ports.inc.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 1c0664ad8..65918f295 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -77,7 +77,7 @@ $config['memcached']['host'] = 'localhost'; $config['memcached']['port'] = 11211; $config['memcached']['ttl'] = 240; -$config['enable_extended_port_metrics'] = false; +$config['extended_port_metrics'] = false; $config['slow_statistics'] = true; // THIS WILL CHANGE TO FALSE IN FUTURE // RRD Format Settings diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index da7a2c6df..b0e11fa24 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -216,7 +216,7 @@ d_echo($port_stats); // FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :> // -- i can make it a function, so that you don't know what it's doing. // -- $ports = adamasMagicFunction($ports_db); ? -if ($config['enable_extended_port_metrics']) { +if ($config['extended_port_metrics']) { // select * doesn't do what we want if multiple tables have the same column name -- last one wins :/ $ports_db = dbFetchRows('SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ?', array($device['device_id'])); } @@ -234,7 +234,7 @@ foreach ($port_stats as $ifIndex => $port) { echo 'valid'; if (!is_array($ports[$port['ifIndex']])) { $port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports'); - if ($config['enable_extended_port_metrics']) { + if ($config['extended_port_metrics']) { dbInsert(array('port_id' => $port_id), 'ports_statistics'); } $ports[$port['ifIndex']] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id)); @@ -245,7 +245,7 @@ foreach ($port_stats as $ifIndex => $port) { dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id'])); $ports[$ifIndex]['deleted'] = '0'; } - if ($config['enable_extended_port_metrics'] && + if ($config['extended_port_metrics'] && $ports[$ifIndex]['ports_statistics_port_id'] === null) { // in case someone enabled the option after the port was already created dbInsert(array('port_id' => $ports[$ifIndex]['port_id']), 'ports_statistics'); @@ -431,12 +431,12 @@ foreach ($ports as $port) { // End parse ifAlias // Update IF-MIB metrics $_stat_oids = $stat_oids_db; - if ($config['enable_extended_port_metrics']) { + if ($config['extended_port_metrics']) { $_stat_oids = $_stat_oids + $stat_oids_db_extended; } foreach ($_stat_oids as $oid) { $port_update = 'update'; - if ($config['enable_extended_port_metrics']) { + if ($config['extended_port_metrics']) { $extended_metric = !in_array($oid, $stat_oids_db, true); if ($extended_metric) { $port_update = 'update_extended'; @@ -587,7 +587,7 @@ foreach ($ports as $port) { // Update Database if (count($port['update'])) { $updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port['port_id'])); - if ($config['enable_extended_port_metrics'] and count($port['update_extended'])) { + if ($config['extended_port_metrics'] and count($port['update_extended'])) { // do we want to do something else with this? $updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port['port_id'])); }