From 8576fdd5ad51db5014ae1d2a536e1928a713bcf6 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 13 May 2011 12:57:11 +0000 Subject: [PATCH] more db* make diskio_ a bit more generic git-svn-id: http://www.observium.org/svn/observer/trunk@2305 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/graphs/bill/bits.inc.php | 2 +- html/includes/graphs/customer/bits.inc.php | 5 ++-- html/includes/graphs/device/bits.inc.php | 5 ++-- .../graphs/device/diskio_bits.inc.php | 23 ++---------------- .../graphs/device/diskio_common.inc.php | 20 ++++++++++++++++ .../includes/graphs/device/diskio_ops.inc.php | 24 ++----------------- 6 files changed, 29 insertions(+), 50 deletions(-) create mode 100644 html/includes/graphs/device/diskio_common.inc.php diff --git a/html/includes/graphs/bill/bits.inc.php b/html/includes/graphs/bill/bits.inc.php index b73beeefc..be807a6a0 100644 --- a/html/includes/graphs/bill/bits.inc.php +++ b/html/includes/graphs/bill/bits.inc.php @@ -4,7 +4,7 @@ $i = 0; -while ($port = mysql_fetch_assoc($ports)) +foreach ($ports as $port) { if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"))) { diff --git a/html/includes/graphs/customer/bits.inc.php b/html/includes/graphs/customer/bits.inc.php index df2771deb..0869dcba2 100644 --- a/html/includes/graphs/customer/bits.inc.php +++ b/html/includes/graphs/customer/bits.inc.php @@ -2,8 +2,7 @@ ## Generate a list of ports and then call the multi_bits grapher to generate from the list -$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".mres($_GET['id'])."' AND D.device_id = I.device_id"); -while ($int = mysql_fetch_assoc($query)) +foreach(dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ? AND D.device_id = I.device_id", array($_GET['id'])) as $int) { if (is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd"))) { @@ -21,4 +20,4 @@ $colour_area_out = "C3D9FF"; include("includes/graphs/generic_multi_bits.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index 2e62145bb..978e39f24 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -4,8 +4,7 @@ $device = device_by_id_cache($id); -$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$id."'"); -while ($int = mysql_fetch_assoc($query)) +foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) as $int) { $ignore = 0; if (is_array($config['device_traffic_iftype'])) @@ -47,4 +46,4 @@ $colour_area_out = "C3D9FF"; include("includes/graphs/generic_multi_bits.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/device/diskio_bits.inc.php b/html/includes/graphs/device/diskio_bits.inc.php index abdf39d38..9773781de 100755 --- a/html/includes/graphs/device/diskio_bits.inc.php +++ b/html/includes/graphs/device/diskio_bits.inc.php @@ -1,24 +1,5 @@ \ No newline at end of file +?> diff --git a/html/includes/graphs/device/diskio_common.inc.php b/html/includes/graphs/device/diskio_common.inc.php new file mode 100644 index 000000000..eec485e06 --- /dev/null +++ b/html/includes/graphs/device/diskio_common.inc.php @@ -0,0 +1,20 @@ + diff --git a/html/includes/graphs/device/diskio_ops.inc.php b/html/includes/graphs/device/diskio_ops.inc.php index 244bcc255..ba3c52721 100755 --- a/html/includes/graphs/device/diskio_ops.inc.php +++ b/html/includes/graphs/device/diskio_ops.inc.php @@ -1,25 +1,5 @@ \ No newline at end of file +?>