forked from loadavg/loadavg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.php
81 lines (57 loc) · 2.07 KB
/
globals.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* LoadAvg - Server Monitoring & Analytics
* http://www.loadavg.com
*
* Initialize globals
*
* @link https://github.com/loadavg/loadavg
* @author Karsten Becker
* @copyright 2014 Sputnik7
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
//for debug
/*
ini_set('display_errors', 'On');
error_reporting(E_ALL);
defined('DEBUG') || define('DEBUG', false );
defined('LOGDEBUG') || define('LOGDEBUG', false );
*/
//for release
ini_set('display_errors', 'Off');
error_reporting(0);
defined('DEBUG') || define('DEBUG', false );
defined('LOGDEBUG') || define('LOGDEBUG', false );
/* Find out where are we on the server*/
$script_path = realpath(basename(getenv("SCRIPT_NAME")));
$slash = explode('/', getenv("SCRIPT_NAME"));
$current_filename = $slash[count($slash) - 1];
$host_url = str_replace($current_filename, "", getenv("SCRIPT_NAME"));
$ROOT_PATH = dirname ($host_url);
//add trailing slash..
//need to check also if it dont end in a / ?
if ( $ROOT_PATH != "/") $ROOT_PATH = $ROOT_PATH . "/";
/* Set script version */
$loadavg_version = "2.2";
defined('SCRIPT_VERSION') || define('SCRIPT_VERSION', $loadavg_version );
/* Set Application Globals */
defined('SCRIPT_ROOT') || define('SCRIPT_ROOT', $ROOT_PATH );
defined('HOME_PATH') || define('HOME_PATH', realpath(dirname(__FILE__) ));
/* Application PATH */
defined('APP_PATH') || define('APP_PATH', realpath(dirname(__FILE__) . '/app'));
defined('PLUGIN_PATH') || define('PLUGIN_PATH', HOME_PATH . '/lib/plugins/' );
/* for loadavg logger support in loadavg */
defined('LOGGER') || define('LOGGER', 'loadavg' );
defined('LOG_PATH') || define('LOG_PATH', HOME_PATH . '/logs/' );
/* for BETA collectd support in loadavg */
//defined('LOGGER') || define('LOGGER', 'collectd' );
//defined('COLLECTD_PATH') || define('COLLECTD_PATH', '/var/lib/collectd/csv/localhost/' );
// Add lib/ to include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(HOME_PATH . '/lib'),
realpath(HOME_PATH . '/lib/modules'),
realpath(HOME_PATH . '/lib/plugins'),
get_include_path(),
)));