1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 05:40:24 +02:00

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

@@ -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;
}
}