fix version display on librenms' "about" page

This commit is contained in:
sthen 2017-05-05 09:37:13 +00:00
parent 7726e9fcce
commit e19e34a266
3 changed files with 50 additions and 15 deletions

View File

@ -1,11 +1,14 @@
# $OpenBSD: Makefile,v 1.39 2017/05/01 13:22:18 sthen Exp $
# $OpenBSD: Makefile,v 1.40 2017/05/05 09:37:13 sthen Exp $
COMMENT = auto-discovering network management/monitoring system
GH_ACCOUNT = librenms
GH_PROJECT = librenms
# used below
GH_TAGNAME = 1.27
EPOCH = 0
REVISION = 0
CATEGORIES = net www
@ -62,7 +65,7 @@ do-install:
find ${INSTDIR} -name '*.orig' -print0 | xargs -r0 rm
mkdir -p ${INSTDIR}/{rrd,logs}
cd ${INSTDIR}; sed -i 's,%PHP%,${MODPHP_BIN},' daily.sh poller-wrapper.py validate.php; \
sed -i 's,%LNMS_VERSION%,$V,' includes/definitions.inc.php
sed -i 's,%LNMS_VERSION%,${GH_TAGNAME},' html/pages/about.inc.php
cp /usr/share/snmp/mibs/OPENBSD-* ${INSTDIR}/mibs/
.include <bsd.port.mk>

View File

@ -1,12 +1,22 @@
$OpenBSD: patch-html_pages_about_inc_php,v 1.7 2017/02/28 00:21:32 sthen Exp $
--- html/pages/about.inc.php.orig Sun Feb 26 23:11:52 2017
+++ html/pages/about.inc.php Sun Feb 26 23:12:00 2017
@@ -161,7 +161,7 @@ $version_date = $versions['local_date'];
$OpenBSD: patch-html_pages_about_inc_php,v 1.8 2017/05/05 09:37:13 sthen Exp $
Index: html/pages/about.inc.php
--- html/pages/about.inc.php.orig
+++ html/pages/about.inc.php
@@ -1,6 +1,6 @@
<?php
$pagetitle[] = 'About';
-$git_log = `git log -10`;
+$git_log = '';
?>
<div class="modal fade" id="git_log" tabindex="-1" role="dialog" aria-labelledby="git_log_label" aria-hidden="true">
<div class="modal-dialog">
@@ -155,7 +155,7 @@ $mysql_version = $versions['mysql_ver'];
$netsnmp_version = $versions['netsnmp_ver'];
$rrdtool_version = $versions['rrdtool_ver'];
$schema_version = $versions['db_schema'];
-$version = `git rev-parse --short HEAD`;
+$version = '%LNMS_VERSION%';
$version_date = $versions['local_date'];
echo "
<div class='table-responsive'>
<table class='table table-condensed' border='0'>
- <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>Version</b></td><td><a href='http://www.librenms.org/changelog.html'>$project_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>Web Server</b></td><td>$webserv_version</td></tr>
<tr><td><b>PHP</b></td><td>$php_version</td></tr>

View File

@ -1,7 +1,15 @@
$OpenBSD: patch-includes_common_php,v 1.10 2017/05/01 13:22:18 sthen Exp $
$OpenBSD: patch-includes_common_php,v 1.11 2017/05/05 09:37:13 sthen Exp $
Index: includes/common.php
--- includes/common.php.orig
+++ includes/common.php
@@ -1107,7 +1107,7 @@ function version_info($remote = true)
@@ -1102,12 +1102,14 @@ function version_info($remote = true)
$output['local_sha'] = $local_sha;
$output['local_date'] = $local_date;
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
+ } else {
+ $output['local_date'] = filemtime($config['install_dir'].'/CHANGELOG');
}
$output['db_schema'] = get_db_schema();
$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));
@ -10,3 +18,17 @@ $OpenBSD: patch-includes_common_php,v 1.10 2017/05/01 13:22:18 sthen Exp $
return $output;
}//end version_info()
@@ -1643,12 +1645,7 @@ function set_numeric($value, $default = 0)
function check_git_exists()
{
- exec('git > /dev/null 2>&1', $response, $exit_code);
- if ($exit_code === 1) {
- return true;
- } else {
- return false;
- }
+ return false;
}
function get_vm_parent_id($device)