Centralised version info + used in output

This commit is contained in:
laf
2016-01-06 00:14:35 +00:00
parent 54591c6d00
commit fdc0eca44d
7 changed files with 68 additions and 14 deletions
+26
View File
@@ -807,3 +807,29 @@ function parse_location($location) {
return array('lat' => $tmp_loc[2], 'lng' => $tmp_loc[3]);
}
}//end parse_location()
/**
* Returns version info
* @return array
**/
function version_info($remote=true) {
global $config;
$output = array();
if ($remote === true && $config['update_channel'] == 'master') {
$api = curl_init();
set_curl_proxy($api);
curl_setopt($api, CURLOPT_USERAGENT,'LibreNMS');
curl_setopt($api, CURLOPT_URL, $config['github_api'].'commits/master');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$output['github'] = json_decode(curl_exec($api),true);
}
$output['local_sha'] = chop(`git rev-parse HEAD`);
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
$output['php_ver'] = phpversion();
$output['mysql_ver'] = dbFetchCell('SELECT version()');
$output['rrdtool_ver'] = implode(' ', array_slice(explode(' ', shell_exec($config['rrdtool'].' --version |head -n1')), 1, 1));
$output['netsnmp_ver'] = shell_exec($config['snmpget'].' --version 2>&1');
return $output;
}//end version_info()
+1
View File
@@ -106,6 +106,7 @@ if (isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT'])) {
$config['project_home'] = 'http://www.librenms.org/';
$config['project_issues'] = 'https://github.com/librenms/librenms/issues';
$config['github_api'] = 'https://api.github.com/repos/librenms/librenms/';
$config['site_style'] = 'light';
// Options are dark or light
$config['stylesheet'] = 'css/styles.css';
-4
View File
@@ -1230,10 +1230,6 @@ function function_check($function) {
return function_exists($function);
}
function get_last_commit() {
return `git log -n 1|head -n1`;
}//end get_last_commit
/**
* Try to determine the address family (IPv4 or IPv6) associated with an SNMP
* transport specifier (like "udp", "udp6", etc.).