Skip to content

Commit

Permalink
Update version.php
Browse files Browse the repository at this point in the history
To include version when not coming from a git clone. such as Mail in a boxes use. Need a text file named version in the same directory as version.php
  • Loading branch information
matidau committed May 31, 2023
1 parent cadbfa0 commit fc62b3d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@
$path = escapeshellarg(dirname(realpath($_SERVER['SCRIPT_FILENAME'])));
$branch = trim(exec("hash git 2>/dev/null && cd $path >/dev/null 2>&1 && git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e \"s/* \(.*\)/\\1/\""));
$version = exec("hash git 2>/dev/null && cd $path >/dev/null 2>&1 && git describe --always 2>/dev/null");
$file = dirname(realpath($_SERVER['SCRIPT_FILENAME'])) . '/version';
if ($branch && $version) {
define("ZPUSH_VERSION", $branch .'-'. $version);
}
elseif (file_exists($file)) {
$line = fgets(fopen($file, 'r'));
define("ZPUSH_VERSION", $line);
}
else {
define("ZPUSH_VERSION", "GIT");
}
Expand Down

0 comments on commit fc62b3d

Please sign in to comment.