From 5aad4a19f83a7e7de4ec9a7c819b9b5f7b4f1b3c Mon Sep 17 00:00:00 2001 From: Paolo Tacconi Date: Fri, 20 Feb 2015 10:09:59 +0100 Subject: Added version tag to siteinfo/json --- mod/siteinfo.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 1f3cd4479..b73dca5b1 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -50,6 +50,18 @@ function siteinfo_init(&$a) { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); + if(! get_config('system','hidden_version_siteinfo')) { + $version = sprintf( t('Version %s'), RED_VERSION ); + if(@is_dir('.git') && function_exists('shell_exec')) { + $commit = @shell_exec('git log -1 --format="%h"'); + $tag = @shell_exec('git describe --tags --abbrev=0'); + } + if(! isset($commit) || strlen($commit) > 16) + $commit = ''; + } + else { + $version = $commit = ''; + } //Statistics $channels_total_stat = intval(get_config('system','channels_total_stat')); @@ -59,7 +71,8 @@ function siteinfo_init(&$a) { $hide_in_statistics = intval(get_config('system','hide_in_statistics')); $data = Array( - 'version' => RED_VERSION, + 'version' => $version, + 'version_tag' => $tag, 'commit' => $commit, 'url' => z_root(), 'plugins' => $visible_plugins, -- cgit v1.2.3 From 2765500844d7c85a6921f26cc708af8d967c9125 Mon Sep 17 00:00:00 2001 From: Paolo Tacconi Date: Fri, 20 Feb 2015 10:29:33 +0100 Subject: Fixes to version tag in siteinfo/json --- mod/siteinfo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/siteinfo.php b/mod/siteinfo.php index b73dca5b1..e6798ce50 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -51,10 +51,10 @@ function siteinfo_init(&$a) { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); if(! get_config('system','hidden_version_siteinfo')) { - $version = sprintf( t('Version %s'), RED_VERSION ); + $version = RED_VERSION; if(@is_dir('.git') && function_exists('shell_exec')) { - $commit = @shell_exec('git log -1 --format="%h"'); - $tag = @shell_exec('git describe --tags --abbrev=0'); + $commit = trim( @shell_exec('git log -1 --format="%h"')); + $tag = trim( @shell_exec('git describe --tags --abbrev=0')); } if(! isset($commit) || strlen($commit) > 16) $commit = ''; -- cgit v1.2.3