summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-11-24 02:32:41 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-11-24 14:43:44 -0600
commita111293b6aa333fdfe727df17eaf4a66ba9c6672 (patch)
treec78922bfc261d6f3c386d5f819f9951d523e1f5e /bin
parent6cd1eaed3f43ff8d3e649f76eb2083587d8d63d1 (diff)
RT#38989: Incorrect paths when cacti is installed from source
Diffstat (limited to 'bin')
-rwxr-xr-xbin/freeside_cacti.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/freeside_cacti.php b/bin/freeside_cacti.php
index 9f8e4dde9..be9ea4e1a 100755
--- a/bin/freeside_cacti.php
+++ b/bin/freeside_cacti.php
@@ -31,22 +31,11 @@ if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($
/* We are not talking to the browser */
$no_http_headers = true;
-/*
-Currently, only drop-device and get-graphs is actually being used by Freeside integration,
-but keeping commented out code for potential future development.
-*/
-
-include(dirname(__FILE__)."/../site/include/global.php");
-include_once($config["base_path"]."/lib/api_device.php");
-include_once($config["base_path"]."/lib/api_automation_tools.php");
-include_once($config["base_path"]."/lib/api_data_source.php");
-include_once($config["base_path"]."/lib/api_graph.php");
-include_once($config["base_path"]."/lib/functions.php");
-
/* process calling arguments */
$action = '';
$ip = '';
$host_template = '';
+$include_path = "../site/include/";
$delete_graphs = FALSE;
$parms = $_SERVER["argv"];
array_shift($parms);
@@ -77,6 +66,9 @@ if (sizeof($parms)) {
case "--delete-graphs":
$delete_graphs = TRUE;
break;
+ case "--include-path":
+ $include_path = trim($value);
+ break;
case "--version":
case "-V":
case "-H":
@@ -90,6 +82,17 @@ if (sizeof($parms)) {
die(default_die());
}
+$include_path = dirname(__FILE__).'/'.$include_path.'/global.php';
+if (!file_exists($include_path)) {
+ die("File " . $include_path . "/global.php not found (check include_path in freeside export config)");
+}
+include($include_path);
+include_once($config["base_path"]."/lib/api_device.php");
+include_once($config["base_path"]."/lib/api_automation_tools.php");
+include_once($config["base_path"]."/lib/api_data_source.php");
+include_once($config["base_path"]."/lib/api_graph.php");
+include_once($config["base_path"]."/lib/functions.php");
+
/* Now take an action */
switch ($action) {
case "get-graphs":