Skip to content

Commit

Permalink
Merge pull request Z-Hub#78 from Z-Hub/version-autodiscover
Browse files Browse the repository at this point in the history
Update version for autodiscover subdirectory
  • Loading branch information
matidau committed Aug 8, 2024
1 parent 582db91 commit 587247e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@
$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';
$fileparent = 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);
}
elseif (file_exists($fileparent)) {
$line = fgets(fopen($fileparent, 'r'));
define("ZPUSH_VERSION", $line);
}
else {
define("ZPUSH_VERSION", "GIT");
}
}
}

0 comments on commit 587247e

Please sign in to comment.