Add git information to system info

This commit is contained in:
Matthew Vale
2015-12-04 12:18:11 +00:00
parent 7c77e1cacd
commit 0be63dff0e
2 changed files with 28 additions and 0 deletions

View File

@@ -85,6 +85,24 @@ $document['title'] = $text['title-sys-status'];
echo " </td>\n";
echo "</tr>\n";
$git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git");
$git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD');
rtrim($git_branch);
$git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD');
rtrim($git_commit);
$git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url');
rtrim($git_commit);
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-git-info']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">\n";
echo " Branch: '$git_branch'<br>\n";
echo " Commit: '$git_commit'<br>\n";
echo " Origin: '$git_origin'<br>\n";
echo " </td>\n";
echo "</tr>\n";
echo "<!--\n";
$tmp_result = shell_exec('uname -a');
echo "-->\n";