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:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user