Add recuperation of the current version from git if available (#731)

* Add recuperation of the current version from git if available
* Include version when auto-reporting an error
This commit is contained in:
Teromene 2018-06-30 09:24:22 +01:00 committed by LogMANOriginal
parent 71c29d4192
commit da6b98851c
4 changed files with 30 additions and 2 deletions

View file

@ -253,7 +253,8 @@ EOD;
echo $inactiveBridges;
?>
<section class="footer">
<a href="https://github.com/RSS-Bridge/rss-bridge">RSS-Bridge 2018-06-10 ~ Public Domain</a><br />
<a href="https://github.com/RSS-Bridge/rss-bridge">RSS-Bridge ~ Public Domain</a><br />
<p class="version"> <?= Configuration::getVersion() ?> </p>
<?= $activeFoundBridgeCount; ?>/<?= count($bridgeList) ?> active bridges. <br />
<?php
if($activeFoundBridgeCount !== count($bridgeList)) {

View file

@ -1,6 +1,8 @@
<?php
class Configuration {
public static $VERSION = "2018-06-10";
public static $config = null;
public static function verifyInstallation() {
@ -102,4 +104,21 @@ class Configuration {
}
public static function getVersion() {
$headFile = '.git/HEAD';
if(file_exists($headFile)) {
$revisionHashFile = '.git/' . substr(file_get_contents($headFile), 5, -1);
$branchName = explode('/', $revisionHashFile)[3];
if(file_exists($revisionHashFile)) {
return 'git.' . $branchName . '.' . substr(file_get_contents($revisionHashFile), 0, 7);
}
}
return Configuration::$VERSION;
}
}

View file

@ -64,7 +64,10 @@ function buildBridgeException($e, $bridge){
$body = 'Error message: `'
. $e->getMessage()
. "`\nQuery string: `"
. $_SERVER['QUERY_STRING'] . '`';
. $_SERVER['QUERY_STRING']
. "`\nVersion: `"
. Configuration::getVersion()
. '`';
$link = buildGitHubIssueQuery($title, $body, 'bug report', $bridge->getMaintainer());

View file

@ -143,6 +143,11 @@ section.footer:hover {
}
section.footer .version {
font-size: 80%;
}
section > h2 {