Skip to content

Commit

Permalink
better version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
digininja committed Jan 30, 2025
1 parent 40bc75b commit 6b44aff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@
$database_type_name = "PostgreSQL";
}

$git_ref = "Unknown";
$git_ref = "<em>Unknown</em><br><br>";

if (PHP_OS == "Linux") {
if (is_dir (".git")) {
$git_ref = shell_exec('cat .git/`cat .git/HEAD | sed "s/.* \(.*\)/\1/"`');
$git_log = shell_exec ("git -c 'safe.directory=*' log -1");
if (!is_null ($git_log)) {
$tmp = explode ("\n", $git_log);
$date = str_replace ("Date: ", "Date: <em>", $tmp[2]);
$git_ref = "<ul><li>" . str_replace ("commit ", "Git reference: <em>", $tmp[0]) . "</em></li><li>" . $date . "</em></li></ul>";
}
}
}

Expand Down Expand Up @@ -77,8 +82,8 @@
<br />
{$DVWAOS}<br />
<br>
Git reference: <em>{$git_ref}</em><br>
<br />
DVWA version: {$git_ref}
PHP version: <em>" . phpversion() . "</em><br />
{$phpVersionWarning}
{$phpDisplayErrors}<br />
Expand Down

0 comments on commit 6b44aff

Please sign in to comment.