This commit is contained in:
2026-01-26 01:10:10 +01:00
parent d36ebfece5
commit b3f0a2ca4e
2 changed files with 17 additions and 17 deletions

View File

@@ -33,25 +33,22 @@ if (!$bootstrapLoaded) {
throw new RuntimeException('No environment config found under config/.'); throw new RuntimeException('No environment config found under config/.');
} }
$versionFiles = [__DIR__ . '/versions.php']; $versionText = null;
if ($envHint) { $versionFile = __DIR__ . '/version.txt';
$versionFiles[] = __DIR__ . '/' . $envHint . '/versions.php'; if (is_file($versionFile)) {
} $raw = trim((string)@file_get_contents($versionFile));
$versionLoaded = false; if ($raw !== '') {
foreach ($versionFiles as $versionFile) { $versionText = $raw;
if ($versionFile && is_file($versionFile)) {
require_once $versionFile;
$versionLoaded = true;
} }
} }
if (!$versionLoaded) { $mainversion = null;
$mainversion = $mainversion ?? 1; $subversion = null;
$subversion = $subversion ?? 0; $patchversion = null;
$patchversion = $patchversion ?? 0; if ($versionText && preg_match('/^(\\d+)\\.(\\d+)\\.(\\d+)$/', $versionText, $m)) {
$mainversion = (int)$m[1];
$subversion = (int)$m[2];
$patchversion = (int)$m[3];
} }
$mainversion = (int)($mainversion ?? 1);
$subversion = (int)($subversion ?? 0);
$patchversion = (int)($patchversion ?? 0);
$emailtemplateConfigPath = __DIR__ . '/emailtemplate.conf.php'; $emailtemplateConfigPath = __DIR__ . '/emailtemplate.conf.php';
if (is_file($emailtemplateConfigPath)) { if (is_file($emailtemplateConfigPath)) {
@@ -63,7 +60,9 @@ if (is_file($emailtemplateConfigPath)) {
$GLOBALS['app_env'] = APP_ENV; $GLOBALS['app_env'] = APP_ENV;
$GLOBALS['app_base_url'] = APP_URL_PRIMARY; $GLOBALS['app_base_url'] = APP_URL_PRIMARY;
$GLOBALS['app_api_base'] = $apiBaseUrl; $GLOBALS['app_api_base'] = $apiBaseUrl;
$GLOBALS['app_version'] = "{$mainversion}.{$subversion}.{$patchversion}"; $GLOBALS['app_version'] = ($mainversion !== null && $subversion !== null && $patchversion !== null)
? "{$mainversion}.{$subversion}.{$patchversion}"
: null;
if (!function_exists('get_version_badge_markup')) { if (!function_exists('get_version_badge_markup')) {
function get_version_badge_markup(): string function get_version_badge_markup(): string

1
config/version.txt Normal file
View File

@@ -0,0 +1 @@
1.1.0