From f99790b1a549d17849940eebf9aadb71e14f5b33 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Oct 2025 17:13:25 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20Mailbox=20Stats=20=C3=BCber=20Dovecot=20?= =?UTF-8?q?mit=20config/mailpool.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Ui/System/UpdateCard.php | 169 +------------------------- 1 file changed, 2 insertions(+), 167 deletions(-) diff --git a/app/Livewire/Ui/System/UpdateCard.php b/app/Livewire/Ui/System/UpdateCard.php index 0a9cdf3..24e0df1 100644 --- a/app/Livewire/Ui/System/UpdateCard.php +++ b/app/Livewire/Ui/System/UpdateCard.php @@ -85,101 +85,6 @@ 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 -// $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(); -// } - - public function pollUpdate(): void { // 1) aktuellen Wrapper-Status einlesen @@ -328,13 +233,11 @@ 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; - // läuft nur, solange KEINE rc vorliegt - $this->running = ($state === 'running' && $this->rc === null); - $this->progressLine = $this->tailUpdateLog(); } @@ -395,74 +298,6 @@ 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;