mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Show git branch in version info
This commit is contained in:
parent
bc615faf88
commit
067597595d
@ -1313,6 +1313,7 @@ Allow from all
|
||||
}
|
||||
|
||||
function refresh_githash() {
|
||||
$gitinfo = array();
|
||||
$path = '../.git/';
|
||||
if (!is_dir($path)) {
|
||||
return;
|
||||
@ -1321,12 +1322,13 @@ Allow from all
|
||||
$refs = trim(substr($head,0,4));
|
||||
if ($refs == 'ref:') {
|
||||
$ref = substr($head,5);
|
||||
$hash = trim(file_get_contents($path . $ref));
|
||||
$gitinfo['hash'] = trim(file_get_contents($path . $ref));
|
||||
$gitinfo['branch'] = basename($path . $ref);
|
||||
} else {
|
||||
$hash = $head;
|
||||
$gitinfo['hash'] = $head;
|
||||
}
|
||||
if (!empty($hash)) {
|
||||
file_put_contents("../githash.txt", $hash);
|
||||
if (!empty($gitinfo)) {
|
||||
file_put_contents("../gitinfo.json", json_encode($gitinfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
16
version.php
16
version.php
@ -2,9 +2,19 @@
|
||||
|
||||
$version="OSS";
|
||||
$version_revision="1.11";
|
||||
$githash = file_get_contents("../githash.txt");
|
||||
if (!empty($githash)) {
|
||||
$version_revision .= " (".substr($githash,0,8).")";
|
||||
$gitinfo = file_get_contents("../gitinfo.json");
|
||||
if (!empty($gitinfo)) {
|
||||
$gitinfo = json_decode($gitinfo);
|
||||
|
||||
if ($gitinfo->branch != 'master') {
|
||||
$version_revision .= " (".substr($gitinfo->hash,0,8)." - ".$gitinfo->branch.")";
|
||||
}
|
||||
else {
|
||||
$version_revision .= " (".substr($gitinfo->hash,0,8).")";
|
||||
}
|
||||
|
||||
} else {
|
||||
$version_revision .= " (?)";
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user