cronjob githash.php modified to work with ZIP-installed system too

This commit is contained in:
OpenXE 2022-12-04 18:59:10 +00:00
parent 23f390a74f
commit c248cb16fb

View File

@ -7,9 +7,15 @@ $path = '../.git/';
if (!is_dir($path)) {
return;
}
$head = trim(substr(file_get_contents($path . 'HEAD'), 4));
$hash = trim(file_get_contents(sprintf($path . $head)));
$head = trim(file_get_contents($path . 'HEAD'));
$refs = trim(substr($head,0,4));
if ($refs == 'ref:') {
$ref = substr($head,5);
echo($path.$ref."\n");
$hash = trim(file_get_contents($path . $ref));
} else {
$hash = $head;
}
if (!empty($hash)) {
file_put_contents("../githash.txt", $hash);
}