From b28d6af29f05772e0cddb25ee2b79693817dee07 Mon Sep 17 00:00:00 2001 From: matidau <65836048+matidau@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:10:33 +1000 Subject: [PATCH] Merge pull request #78 from Z-Hub/version-autodiscover Update version for autodiscover subdirectory --- src/version.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/version.php b/src/version.php index 3c03528e..633b4cd3 100644 --- a/src/version.php +++ b/src/version.php @@ -28,6 +28,7 @@ $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); } @@ -35,7 +36,11 @@ $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"); } -} \ No newline at end of file +}