mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #3782 from murrant/git-date
Add date to git version info
This commit is contained in:
@@ -145,7 +145,7 @@ echo "
|
|||||||
|
|
||||||
<h3>LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.</h3>
|
<h3>LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.</h3>
|
||||||
<?php
|
<?php
|
||||||
$versions = version_info();
|
$versions = version_info(false);
|
||||||
$project_name = $config['project_name'];
|
$project_name = $config['project_name'];
|
||||||
$project_version = $config['version'];
|
$project_version = $config['version'];
|
||||||
$apache_version = str_replace('Apache/', '', $_SERVER['SERVER_SOFTWARE']);
|
$apache_version = str_replace('Apache/', '', $_SERVER['SERVER_SOFTWARE']);
|
||||||
@@ -155,12 +155,12 @@ $netsnmp_version = $versions['netsnmp_ver'];
|
|||||||
$rrdtool_version = $versions['rrdtool_ver'];
|
$rrdtool_version = $versions['rrdtool_ver'];
|
||||||
$schema_version = $versions['db_schema'];
|
$schema_version = $versions['db_schema'];
|
||||||
$version = `git rev-parse --short HEAD`;
|
$version = `git rev-parse --short HEAD`;
|
||||||
|
$version_date = $versions['local_date'];
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<div class='table-responsive'>
|
<div class='table-responsive'>
|
||||||
<table class='table table-condensed' border='0'>
|
<table class='table table-condensed' border='0'>
|
||||||
<tr><td><b>Version</b></td><td><a href='http://www.librenms.org/changelog.html'>$version</a></td></tr>
|
<tr><td><b>Version</b></td><td><a href='http://www.librenms.org/changelog.html'>$version - <span id='version_date'>$version_date</span></a></td></tr>
|
||||||
<tr><td><b>DB Schema</b></td><td>#$schema_version</td></tr>
|
<tr><td><b>DB Schema</b></td><td>#$schema_version</td></tr>
|
||||||
<tr><td><b>Apache</b></td><td>$apache_version</td></tr>
|
<tr><td><b>Apache</b></td><td>$apache_version</td></tr>
|
||||||
<tr><td><b>PHP</b></td><td>$php_version</td></tr>
|
<tr><td><b>PHP</b></td><td>$php_version</td></tr>
|
||||||
@@ -234,4 +234,8 @@ echo "
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// convert the version date from ISO 8601 to the browser's timezone
|
||||||
|
var ver_date = $('#version_date');
|
||||||
|
ver_date.text(new Date(ver_date.text()).toString());
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1038,7 +1038,9 @@ function version_info($remote=true) {
|
|||||||
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
|
||||||
$output['github'] = json_decode(curl_exec($api),true);
|
$output['github'] = json_decode(curl_exec($api),true);
|
||||||
}
|
}
|
||||||
$output['local_sha'] = rtrim(`git rev-parse HEAD`);
|
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ci' -s HEAD`));
|
||||||
|
$output['local_sha'] = $local_sha;
|
||||||
|
$output['local_date'] = $local_date;
|
||||||
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
|
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
|
||||||
|
|
||||||
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
|
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
|
||||||
|
@@ -27,6 +27,7 @@ $versions = version_info(false);
|
|||||||
echo "Version info:\n";
|
echo "Version info:\n";
|
||||||
$cur_sha = $versions['local_sha'];
|
$cur_sha = $versions['local_sha'];
|
||||||
echo "Commit SHA: $cur_sha\n";
|
echo "Commit SHA: $cur_sha\n";
|
||||||
|
echo "Commit Date: ".$versions['local_date']."\n";
|
||||||
echo "DB Schema: ".$versions['db_schema']."\n";
|
echo "DB Schema: ".$versions['db_schema']."\n";
|
||||||
echo "PHP: ".$versions['php_ver']."\n";
|
echo "PHP: ".$versions['php_ver']."\n";
|
||||||
echo "MySQL: ".$versions['mysql_ver']."\n";
|
echo "MySQL: ".$versions['mysql_ver']."\n";
|
||||||
|
@@ -76,7 +76,9 @@ $versions = version_info();
|
|||||||
echo "Version info:\n";
|
echo "Version info:\n";
|
||||||
$cur_sha = $versions['local_sha'];
|
$cur_sha = $versions['local_sha'];
|
||||||
if ($config['update_channel'] == 'master' && $cur_sha != $versions['github']['sha']) {
|
if ($config['update_channel'] == 'master' && $cur_sha != $versions['github']['sha']) {
|
||||||
print_warn("Your install is out of date: $cur_sha");
|
$commit_date = new DateTime($versions['local_date']);
|
||||||
|
$commit_date->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
print_warn("Your install is out of date: $cur_sha " . $commit_date->format('(r)'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "Commit SHA: $cur_sha\n";
|
echo "Commit SHA: $cur_sha\n";
|
||||||
|
Reference in New Issue
Block a user