diff --git a/app/Console/Commands/CheckUpdates.php b/app/Console/Commands/CheckUpdates.php index f5f2a9a..de07c78 100644 --- a/app/Console/Commands/CheckUpdates.php +++ b/app/Console/Commands/CheckUpdates.php @@ -14,46 +14,42 @@ class CheckUpdates extends Command $currentNorm = $this->readInstalledVersionNorm(); $currentRaw = $this->readInstalledVersionRaw() ?? ($currentNorm ? 'v'.$currentNorm : null); - // Neuesten Tag vom Remote holen (semver-freundlich sortiert) $appPath = base_path(); $cmd = <<normalizeVersion($latestTagRaw); - // Nichts gefunden -> Caches leeren + // Nichts gefunden -> alles leeren if (!$latestNorm) { cache()->forget('updates:latest'); cache()->forget('updates:latest_raw'); - cache()->forget('mailwolt.update_available'); // Legacy + cache()->forget('mailwolt.update_available'); // legacy $this->warn('Keine Release-Tags gefunden.'); return self::SUCCESS; } - // Cache schreiben - cache()->put('updates:latest', $latestNorm, now()->addMinutes(10)); - cache()->put('updates:latest_raw', $latestTagRaw, now()->addMinutes(10)); - cache()->forever('mailwolt.update_available', $latestNorm); // Legacy-Kompat - - // Vergleich & Ausgabe + // Nur wenn wirklich neuer als installiert -> Keys setzen if ($currentNorm && version_compare($latestNorm, $currentNorm, '>')) { + cache()->forever('updates:latest', $latestNorm); + cache()->forever('updates:latest_raw', $latestTagRaw ?: ('v'.$latestNorm)); + cache()->forever('mailwolt.update_available', $latestNorm); // legacy-kompat $this->info("Update verfügbar: {$latestTagRaw} (installiert: ".($currentRaw ?? $currentNorm).")"); } else { + // Kein Update -> Keys löschen + cache()->forget('updates:latest'); + cache()->forget('updates:latest_raw'); + cache()->forget('mailwolt.update_available'); // legacy $this->info("Aktuell (installiert: ".($currentRaw ?? $currentNorm ?? 'unbekannt').")."); - // Kein Update – Legacy-Key aufräumen (UI liest die neuen Keys) - cache()->forget('mailwolt.update_available'); } cache()->put('updates:last_checked_at', now(), now()->addMinutes(10));