From b52ea46f227a176acdd358ba1199df25c20ed8a2 Mon Sep 17 00:00:00 2001 From: boban Date: Thu, 23 Apr 2026 02:02:57 +0200 Subject: [PATCH] Fix: Lokal immer git describe als installierte Version verwenden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/Console/Commands/CheckUpdates.php | 12 +++++++++--- app/Livewire/Ui/System/UpdatePage.php | 7 +++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/CheckUpdates.php b/app/Console/Commands/CheckUpdates.php index df45ca2..5309497 100644 --- a/app/Console/Commands/CheckUpdates.php +++ b/app/Console/Commands/CheckUpdates.php @@ -61,15 +61,21 @@ class CheckUpdates extends Command 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 = [ - '/var/lib/mailwolt/version', // vom Wrapper (normiert) - base_path('VERSION'), // App-Fallback + '/var/lib/mailwolt/version', + base_path('VERSION'), ]; foreach ($paths as $p) { $raw = @trim(@file_get_contents($p) ?: ''); if ($raw !== '') return $this->normalizeVersion($raw); } - // Noch ein Fallback aus RAW-Datei $raw = $this->readInstalledVersionRaw(); return $raw ? $this->normalizeVersion($raw) : null; } diff --git a/app/Livewire/Ui/System/UpdatePage.php b/app/Livewire/Ui/System/UpdatePage.php index c85b172..21c8aa9 100644 --- a/app/Livewire/Ui/System/UpdatePage.php +++ b/app/Livewire/Ui/System/UpdatePage.php @@ -255,6 +255,13 @@ class UpdatePage extends Component 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) ?: ''); if ($v !== '') return $v;