refresh githash.txt on login screen, removed cronjob githash.php part 2

This commit is contained in:
OpenXE
2022-12-12 16:16:49 +00:00
parent 0ad4b9600c
commit 5ccd0edbb9
3 changed files with 20 additions and 25 deletions
+19 -1
View File
@@ -571,7 +571,7 @@ class Acl
public function Login()
{
include dirname(__DIR__).'/../cronjobs/githash.php';
$this->refresh_githash();
include dirname(__DIR__).'/../version.php';
$this->app->Tpl->Set('XENTRALVERSION',"V.".$version_revision);
@@ -1297,4 +1297,22 @@ Allow from all
// HTACCESS SECURITY END
}
function refresh_githash() {
$path = '../.git/';
if (!is_dir($path)) {
return;
}
$head = trim(file_get_contents($path . 'HEAD'));
$refs = trim(substr($head,0,4));
if ($refs == 'ref:') {
$ref = substr($head,5);
$hash = trim(file_get_contents($path . $ref));
} else {
$hash = $head;
}
if (!empty($hash)) {
file_put_contents("../githash.txt", $hash);
}
}
}