From 62dd9a10226dbea561c19829f9a75e31472909fc Mon Sep 17 00:00:00 2001
From: Pim van den Berg
Date: Sun, 11 Oct 2009 19:23:26 +0200
Subject: remove code duplication from function graphs_from_plugin
---
inc/collectd.inc.php | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
(limited to 'inc')
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 306086a..525b931 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -110,16 +110,18 @@ function graphs_from_plugin($host, $plugin) {
$ts = collectd_plugindetail($host, $plugin, 't');
$tis = collectd_plugindetail($host, $plugin, 'ti');
if (!$pis) $pis = array('NULL');
- if (!$tis) $tis = array('NULL');
+ if (!$tis || $CONFIG['groupby'][$plugin] == 'type')
+ $tis = array('NULL');
foreach($pis as $pi) {
- if ($CONFIG['groupby'][$plugin] == 'type') {
+ foreach ($tis as $ti) {
foreach ($ts as $t) {
$items = array(
'h' => $host,
'p' => $plugin,
'pi' => $pi,
- 't' => $t
+ 't' => $t,
+ 'ti' => $ti
);
printf('
'."\n",
$CONFIG['weburl'],
@@ -128,24 +130,6 @@ function graphs_from_plugin($host, $plugin) {
build_url('graph.php', $items)
);
}
- } else {
- foreach ($tis as $ti) {
- foreach ($ts as $t) {
- $items = array(
- 'h' => $host,
- 'p' => $plugin,
- 'pi' => $pi,
- 't' => $t,
- 'ti' => $ti
- );
- printf('
'."\n",
- $CONFIG['weburl'],
- build_url('detail.php', $items),
- $CONFIG['weburl'],
- build_url('graph.php', $items)
- );
- }
- }
}
}
}
--
cgit v1.1