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

main v1.0.49
boban 2025-10-26 17:08:35 +01:00
parent 1443a693bd
commit 1bf41063ae
2 changed files with 132 additions and 19 deletions

View File

@ -85,6 +85,45 @@ class UpdateCard extends Component
$this->recomputeUi();
}
// public function pollUpdate(): void
// {
// $this->refreshLowLevelState();
//
// $started = (int) Cache::get($this->cacheStartedAtKey, 0);
// if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
// $this->running = false;
// $this->rc ??= 0; // failsafe: als erfolgreich werten
// }
//
// if (!$this->running) {
// Cache::forget($this->cacheStartedAtKey);
//
// $this->reloadVersionsAndStatus();
// $this->recompute();
//
// if ($this->rc === 0 && !$this->postActionsDone) {
// // Restarts DE-coupled
// @shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
// $this->postActionsDone = true;
//
// $ver = $this->displayCurrent ?? 'aktuelle Version';
// $this->progressLine = '';
// $this->dispatch('toast', type: 'success', title: 'Update erfolgreich',
// text: "MailWolt wurde auf {$ver} aktualisiert.", badge: 'System', duration: 4000);
// $this->dispatch('reload-page', delay: 5000);
// } elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// $this->postActionsDone = true;
// $this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
// $this->dispatch('toast', type: 'error', title: 'Update fehlgeschlagen',
// text: $this->progressLine ?: 'Bitte /var/log/mailwolt-update.log prüfen', badge: 'System', duration: -1);
// }
//
// $this->state = 'idle';
// }
//
// $this->recomputeUi();
// }
// public function pollUpdate(): void
// {
// // 1) aktuellen Wrapper-Status einlesen
@ -140,42 +179,59 @@ class UpdateCard extends Component
// $this->recomputeUi();
// }
public function pollUpdate(): void
{
// 1) aktuellen Wrapper-Status einlesen
$this->refreshLowLevelState();
$started = (int) Cache::get($this->cacheStartedAtKey, 0);
// 2) Failsafe
$started = (int)Cache::get($this->cacheStartedAtKey, 0);
if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
$this->running = false;
$this->rc ??= 0; // failsafe: als erfolgreich werten
$this->rc ??= 0; // wenn unklar, als erfolgreich werten
}
// 3) Abschluss?
if (!$this->running) {
Cache::forget($this->cacheStartedAtKey);
// Nachlauf: Versionen & Vergleich neu aufbauen
$this->reloadVersionsAndStatus();
$this->recompute();
if ($this->rc === 0 && !$this->postActionsDone) {
// Restarts DE-coupled
// Dienste neu starten (asynchron)
@shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
$this->postActionsDone = true;
$ver = $this->displayCurrent ?? 'aktuelle Version';
$this->progressLine = '';
$this->dispatch('toast', type: 'success', title: 'Update erfolgreich',
text: "MailWolt wurde auf {$ver} aktualisiert.", badge: 'System', duration: 4000);
$this->dispatch('reload-page', delay: 5000);
$this->dispatch('toast',
type: 'success',
title: 'Update erfolgreich',
text: "MailWolt wurde auf {$ver} aktualisiert.",
badge: 'System',
duration: 4000
);
} elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// Fehlerfall
$this->postActionsDone = true;
$this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
$this->dispatch('toast', type: 'error', title: 'Update fehlgeschlagen',
text: $this->progressLine ?: 'Bitte /var/log/mailwolt-update.log prüfen', badge: 'System', duration: -1);
$this->dispatch('toast',
type: 'error',
title: 'Update fehlgeschlagen',
text: $this->progressLine ?: 'Bitte Logs prüfen: /var/log/mailwolt-update.log',
badge: 'System',
duration: 0
);
}
$this->state = 'idle';
}
// UI bei jedem Poll neu ableiten
$this->recomputeUi();
}
@ -269,17 +325,6 @@ class UpdateCard extends Component
}
// protected function refreshLowLevelState(): void
// {
// $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
// $this->running = ($state === 'running');
//
// $rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
// $this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
//
// $this->progressLine = $this->tailUpdateLog();
// }
protected function refreshLowLevelState(): void
{
$state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
@ -350,6 +395,74 @@ class UpdateCard extends Component
}
}
// public function pollUpdate(): void
// {
// // 1) aktuellen Wrapper-Status einlesen
// $this->refreshLowLevelState();
//
// // 2) Failsafe
// $started = (int)Cache::get($this->cacheStartedAtKey, 0);
// if ($this->running && $started > 0 && (time() - $started) > $this->failsafeSeconds) {
// $this->running = false;
// $this->rc ??= 0; // wenn unklar, als erfolgreich werten
// }
//
// // 3) Abschluss?
// if (!$this->running) {
// Cache::forget($this->cacheStartedAtKey);
//
// // Nachlauf: Versionen & Vergleich neu aufbauen
// $this->reloadVersionsAndStatus();
// $this->recompute();
//
// if ($this->rc === 0 && !$this->postActionsDone) {
// // Dienste neu starten (asynchron)
// @shell_exec('nohup php /var/www/mailwolt/artisan mailwolt:restart-services >/dev/null 2>&1 &');
// $this->postActionsDone = true;
//
// $ver = $this->displayCurrent ?? 'aktuelle Version';
// $this->progressLine = '';
// $this->dispatch('reload-page', delay: 5000);
// $this->dispatch('toast',
// type: 'success',
// title: 'Update erfolgreich',
// text: "MailWolt wurde auf {$ver} aktualisiert.",
// badge: 'System',
// duration: 4000
// );
// } elseif ($this->rc !== null && $this->rc !== 0 && !$this->postActionsDone) {
// // Fehlerfall
// $this->postActionsDone = true;
// $this->errorLine = "Update fehlgeschlagen (rc={$this->rc}).";
// $this->dispatch('toast',
// type: 'error',
// title: 'Update fehlgeschlagen',
// text: $this->progressLine ?: 'Bitte Logs prüfen: /var/log/mailwolt-update.log',
// badge: 'System',
// duration: 0
// );
// }
//
// $this->state = 'idle';
// }
//
// // UI bei jedem Poll neu ableiten
// $this->recomputeUi();
// }
// protected function refreshLowLevelState(): void
// {
// $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
// $this->running = ($state === 'running');
//
// $rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
// $this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
//
// $this->progressLine = $this->tailUpdateLog();
// }
//namespace App\Livewire\Ui\System;
//
//use Illuminate\Support\Facades\Artisan;

View File

@ -5,7 +5,7 @@
<span class="text-[11px] tracking-wide uppercase text-white/70">Dienste</span>
</div>
</div>
<ul class="overflow-auto divide-y divide-white/5 max-h-96">
@forelse($servicesCompact as $s)
<li class="grid grid-cols-[auto,1fr,auto] items-center gap-3 py-2">