Fix: Lokal immer git describe als installierte Version verwenden

Auf APP_ENV=local wird die aktuelle Version direkt aus git describe
gelesen statt aus /var/lib/mailwolt/version — verhindert falschen
"Update verfügbar" Hinweis auf der Entwicklungsmaschine.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.142
boban 2026-04-23 02:02:57 +02:00
parent ad60bd61fe
commit b52ea46f22
2 changed files with 16 additions and 3 deletions

View File

@ -61,15 +61,21 @@ class CheckUpdates extends Command
private function readInstalledVersionNorm(): ?string private function readInstalledVersionNorm(): ?string
{ {
// Lokal: git describe gibt immer den aktuellen Stand
if (app()->isLocal()) {
$tag = @trim((string) shell_exec('git -C ' . escapeshellarg(base_path()) . ' describe --tags --abbrev=0 2>/dev/null'));
$v = $this->normalizeVersion($tag);
if ($v) return $v;
}
$paths = [ $paths = [
'/var/lib/mailwolt/version', // vom Wrapper (normiert) '/var/lib/mailwolt/version',
base_path('VERSION'), // App-Fallback base_path('VERSION'),
]; ];
foreach ($paths as $p) { foreach ($paths as $p) {
$raw = @trim(@file_get_contents($p) ?: ''); $raw = @trim(@file_get_contents($p) ?: '');
if ($raw !== '') return $this->normalizeVersion($raw); if ($raw !== '') return $this->normalizeVersion($raw);
} }
// Noch ein Fallback aus RAW-Datei
$raw = $this->readInstalledVersionRaw(); $raw = $this->readInstalledVersionRaw();
return $raw ? $this->normalizeVersion($raw) : null; return $raw ? $this->normalizeVersion($raw) : null;
} }

View File

@ -255,6 +255,13 @@ class UpdatePage extends Component
protected function readCurrentVersion(): ?string protected function readCurrentVersion(): ?string
{ {
// Lokal: direkt aus git describe lesen damit Entwicklungsumgebung immer aktuell ist
if (app()->isLocal()) {
$tag = @trim((string) shell_exec('git -C ' . escapeshellarg(base_path()) . ' describe --tags --abbrev=0 2>/dev/null'));
$v = $this->normalizeVersion($tag);
if ($v) return $v;
}
$v = @trim(@file_get_contents(self::VERSION_FILE) ?: ''); $v = @trim(@file_get_contents(self::VERSION_FILE) ?: '');
if ($v !== '') return $v; if ($v !== '') return $v;