From db5bc6fbd9a568bd3267fecff076da455d5e23f7 Mon Sep 17 00:00:00 2001
From: Pim van den Berg
Date: Mon, 28 Sep 2009 19:53:38 +0200
Subject: change webdir/weburl and include/require usage
- Don't depend on includes from files that are included.
- Don't use webdir with includes/requires (also because webdir couldn't
be available in some cases).
- Use common.inc.php instead of config.php in all plugins to have all
configuration settings available.
---
detail.php | 1 +
host.php | 1 +
inc/html.inc.php | 8 +++++---
plugin/cpu.php | 6 +++---
plugin/df.php | 4 ++--
plugin/disk.php | 4 ++--
plugin/entropy.php | 4 ++--
plugin/interface.php | 4 ++--
plugin/irq.php | 6 +++---
plugin/load.php | 4 ++--
plugin/memory.php | 6 +++---
plugin/processes.php | 6 +++---
plugin/sensors.php | 6 +++---
plugin/swap.php | 6 +++---
plugin/users.php | 4 ++--
15 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/detail.php b/detail.php
index d1f2126..3512716 100644
--- a/detail.php
+++ b/detail.php
@@ -1,5 +1,6 @@
Collectd Graph Panel
-
+
@@ -22,8 +26,6 @@ function html_end() {
EOT;
}
-require_once 'conf/common.inc.php';
-require_once 'inc/rrdtool.class.php';
function host_summary($hosts) {
global $CONFIG;
diff --git a/plugin/cpu.php b/plugin/cpu.php
index 10fbf56..04ef3a4 100644
--- a/plugin/cpu.php
+++ b/plugin/cpu.php
@@ -2,8 +2,8 @@
# Collectd CPU plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
## LAYOUT
# cpu-X/
@@ -17,7 +17,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
# cpu-X/cpu-wait.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti');
$obj = new Type_GenericStacked;
diff --git a/plugin/df.php b/plugin/df.php
index 6398249..780ca0c 100644
--- a/plugin/df.php
+++ b/plugin/df.php
@@ -2,8 +2,8 @@
# Collectd Df plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
# LAYOUT
#
diff --git a/plugin/disk.php b/plugin/disk.php
index 298c179..e73cbac 100644
--- a/plugin/disk.php
+++ b/plugin/disk.php
@@ -2,8 +2,8 @@
# Collectd Disk plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericIO.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericIO.class.php';
## LAYOUT
# disk-XXXX/
diff --git a/plugin/entropy.php b/plugin/entropy.php
index 55159dc..58d810b 100644
--- a/plugin/entropy.php
+++ b/plugin/entropy.php
@@ -2,8 +2,8 @@
# Collectd Entropy plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/Default.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/Default.class.php';
## LAYOUT
# entropy/entropy.rrd
diff --git a/plugin/interface.php b/plugin/interface.php
index 2f345f9..bda0550 100644
--- a/plugin/interface.php
+++ b/plugin/interface.php
@@ -2,8 +2,8 @@
# Collectd Interface plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericIO.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericIO.class.php';
# LAYOUT
# interface/
diff --git a/plugin/irq.php b/plugin/irq.php
index 2759c0e..6a05245 100644
--- a/plugin/irq.php
+++ b/plugin/irq.php
@@ -2,15 +2,15 @@
# Collectd IRQ plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
## LAYOUT
# irq/
# irq/irq-XX.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti');
sort($tinstance);
diff --git a/plugin/load.php b/plugin/load.php
index d7db740..17002ea 100644
--- a/plugin/load.php
+++ b/plugin/load.php
@@ -2,8 +2,8 @@
# Collectd Load plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/Default.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/Default.class.php';
## LAYOUT
# load/load.rrd
diff --git a/plugin/memory.php b/plugin/memory.php
index 7944238..29f93fe 100644
--- a/plugin/memory.php
+++ b/plugin/memory.php
@@ -2,8 +2,8 @@
# Collectd Memory plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
## LAYOUT
# memory/
@@ -13,7 +13,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
# memory/memory-used.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti');
$obj = new Type_GenericStacked;
diff --git a/plugin/processes.php b/plugin/processes.php
index 445e1e4..32a925d 100644
--- a/plugin/processes.php
+++ b/plugin/processes.php
@@ -2,8 +2,8 @@
# Collectd CPU plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
## LAYOUT
# processes/
@@ -15,7 +15,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
# processes/ps_state-sleeping.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti');
$obj = new Type_GenericStacked;
diff --git a/plugin/sensors.php b/plugin/sensors.php
index ad43378..c7f038b 100644
--- a/plugin/sensors.php
+++ b/plugin/sensors.php
@@ -2,8 +2,8 @@
# Collectd Sensors plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/Default.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/Default.class.php';
## LAYOUT
# disk-XXXX/
@@ -12,7 +12,7 @@ require_once $CONFIG['webdir'].'/type/Default.class.php';
# disk-XXXX/voltage-XXXX.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type));
$obj = new Type_Default;
diff --git a/plugin/swap.php b/plugin/swap.php
index dfd9ba1..d1ba823 100644
--- a/plugin/swap.php
+++ b/plugin/swap.php
@@ -2,8 +2,8 @@
# Collectd Swap plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/GenericStacked.class.php';
## LAYOUT
# swap/
@@ -12,7 +12,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
# swap/swap-used.rrd
# grouped
-require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
+require_once 'inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti');
$obj = new Type_GenericStacked;
diff --git a/plugin/users.php b/plugin/users.php
index dfcaee3..41d4c25 100644
--- a/plugin/users.php
+++ b/plugin/users.php
@@ -2,8 +2,8 @@
# Collectd Users plugin
-require_once $CONFIG['webdir'].'/conf/config.php';
-require_once $CONFIG['webdir'].'/type/Default.class.php';
+require_once 'conf/common.inc.php';
+require_once 'type/Default.class.php';
## LAYOUT
# users/users.rrd
--
cgit v1.1