Skip to content

Commit

Permalink
Merge pull request Z-Hub#13 from Z-Hub/update-version-php-without-git…
Browse files Browse the repository at this point in the history
…-clone

Update version.php
  • Loading branch information
matidau authored Jun 11, 2023
2 parents 52f9c73 + fc62b3d commit ca9e720
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 ca9e720

Please sign in to comment.