Check if .git dir exists before accessing it

This commit is contained in:
phl0 2017-03-27 13:53:25 +02:00
parent 03285d6011
commit 50811fb256
No known key found for this signature in database
GPG key ID: 48EA1E640798CA9A

View file

@ -851,7 +851,11 @@ function decodeAlias($logLine) {
function getGitVersion(){
exec("git rev-parse HEAD", $output);
return 'GitID #<a href="https://github.com/dg9vh/MMDVMHost-Dashboard/commit/'.substr($output[0],0,7).'">'.substr($output[0],0,7).'</a>';
if (file_exists(".git")) {
exec("git rev-parse HEAD", $output);
return 'GitID #<a href="https://github.com/dg9vh/MMDVMHost-Dashboard/commit/'.substr($output[0],0,7).'">'.substr($output[0],0,7).'</a>';
} else {
return 'GitID unknown';
}
}
?>