[Debug] Try/catch so that page loads normally in case git can't be executed on host

这个提交包含在:
Andreas 2023-07-14 23:29:54 +02:00
父节点 67b8332904
当前提交 36585d12f6

查看文件

@ -165,6 +165,8 @@
</div> </div>
<?php if (file_exists('.git')) { ?> <?php if (file_exists('.git')) { ?>
<?php <?php
//Below is a failsafe where git commands fail
try {
$commitHash = trim(exec('git log --pretty="%H" -n1 HEAD')); $commitHash = trim(exec('git log --pretty="%H" -n1 HEAD'));
$branch = ''; $branch = '';
$remote = ''; $remote = '';
@ -193,6 +195,9 @@
} }
$tag = trim(exec('git describe --tags '.$commitHash)); $tag = trim(exec('git describe --tags '.$commitHash));
} }
} catch (\Throwable $th) {
$commitHash = "";
}
?> ?>
<?php if($commitHash != "") { ?> <?php if($commitHash != "") { ?>