From 846c5ab0c9b8b098f56e91df41a819ecefb51fc5 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 6 Jul 2016 12:15:14 -0500 Subject: [PATCH] Add date to git version info valdiate: local tz, rfc2822 poller: iso 8601 about: iso 8601 -> browser local Also, do not fetch github info on about page, it isn't used. --- html/pages/about.inc.php | 10 +++++++--- includes/common.php | 4 +++- poller.php | 1 + validate.php | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/html/pages/about.inc.php b/html/pages/about.inc.php index fef100db63..0b2bafd4e9 100644 --- a/html/pages/about.inc.php +++ b/html/pages/about.inc.php @@ -145,7 +145,7 @@ echo "

LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.

- + @@ -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()); diff --git a/includes/common.php b/includes/common.php index dc505e67b1..d7a0a95102 100644 --- a/includes/common.php +++ b/includes/common.php @@ -1036,7 +1036,9 @@ function version_info($remote=true) { curl_setopt($api, CURLOPT_RETURNTRANSFER, 1); $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['db_schema'] = dbFetchCell('SELECT version FROM dbSchema'); diff --git a/poller.php b/poller.php index 6014b70733..36ee777a04 100755 --- a/poller.php +++ b/poller.php @@ -27,6 +27,7 @@ $versions = version_info(false); echo "Version info:\n"; $cur_sha = $versions['local_sha']; echo "Commit SHA: $cur_sha\n"; +echo "Commit Date: ".$versions['local_date']."\n"; echo "DB Schema: ".$versions['db_schema']."\n"; echo "PHP: ".$versions['php_ver']."\n"; echo "MySQL: ".$versions['mysql_ver']."\n"; diff --git a/validate.php b/validate.php index 230ab0b393..fd345f7d1d 100755 --- a/validate.php +++ b/validate.php @@ -76,7 +76,9 @@ $versions = version_info(); echo "Version info:\n"; $cur_sha = $versions['local_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 { echo "Commit SHA: $cur_sha\n";
Version$version
Version$version - $version_date
DB Schema#$schema_version
Apache$apache_version
PHP$php_version