Fix: Mailbox Stats über Dovecot mit config/mailpool.php

main v1.0.35
boban 2025-10-25 14:56:01 +02:00
parent da54fbc7f3
commit f4e03fab82
1 changed files with 12 additions and 16 deletions

View File

@ -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 = <<<BASH
set -e
cd {$appPath}
git fetch --tags --force --quiet origin +refs/tags/*:refs/tags/*
# Beste Wahl zuerst: v*-Tags semver-sortiert, sonst alle Tags
(git tag -l 'v*' --sort=-v:refname | head -n1) || true
BASH;
(git tag -l 'v*' --sort=-v:refname | head -n1) || true
BASH;
$latestTagRaw = trim((string) shell_exec($cmd));
if ($latestTagRaw === '') {
// Fallback auf alle Tags (ohne Filter), falls keine v*-Tags existieren
$latestTagRaw = trim((string) shell_exec("cd {$appPath} && git tag -l --sort=-v:refname | head -n1"));
}
// Normieren (v weg, Suffixe wie -3-gabcd/-dirty entfernen)
$latestNorm = $this->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));