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
{
// 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;
}

View File

@ -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;