From 3b816e2198df785739b53110ea13b4f4a9d097f0 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Oct 2025 20:44:12 +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/Jobs/RunHealthChecks.php | 7 ++++-- app/Livewire/Ui/System/UpdateCard.php | 5 ---- app/Livewire/Ui/System/WoltguardCard.php | 32 +++++++++++++++++------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/Jobs/RunHealthChecks.php b/app/Jobs/RunHealthChecks.php index 0c3fa7c..53374e8 100644 --- a/app/Jobs/RunHealthChecks.php +++ b/app/Jobs/RunHealthChecks.php @@ -2,7 +2,7 @@ namespace App\Jobs; -use App\Models\Setting; +use App\Models\Setting as SettingsModel; use App\Support\CacheVer; use App\Support\WoltGuard\Probes; use Illuminate\Contracts\Queue\ShouldQueue; @@ -39,7 +39,10 @@ class RunHealthChecks implements ShouldQueue $payload = ['ts' => time(), 'rows' => $svcRows]; Cache::put(CacheVer::k('health:services'), $payload, 300); - Setting::set('woltguard.services', $payload); + Log::info('WG: writing services', ['count'=>count($svcRows)]); + SettingsModel::set('woltguard.services', $payload); + Cache::forget('health:services'); + } /** Wraps a probe; logs and returns fallback on error */ diff --git a/app/Livewire/Ui/System/UpdateCard.php b/app/Livewire/Ui/System/UpdateCard.php index 4936f5a..29bd70b 100644 --- a/app/Livewire/Ui/System/UpdateCard.php +++ b/app/Livewire/Ui/System/UpdateCard.php @@ -242,12 +242,7 @@ class UpdateCard extends Component $rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: ''); $this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null; - - // ← harte Wahrheit: Sobald es eine rc gibt, ist es NICHT mehr running – - // selbst wenn "state" (noch) "running" enthält. $this->running = ($this->rc === null) && ($state !== 'done'); - - // optional: letzte Logzeile für die UI $this->progressLine = $this->tailUpdateLog(); // $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: ''); diff --git a/app/Livewire/Ui/System/WoltguardCard.php b/app/Livewire/Ui/System/WoltguardCard.php index 35a863d..cbbfb4f 100644 --- a/app/Livewire/Ui/System/WoltguardCard.php +++ b/app/Livewire/Ui/System/WoltguardCard.php @@ -75,24 +75,38 @@ class WoltguardCard extends Component // elseif (isset($val[0]) && is_array($val[0]) && array_key_exists('name', $val[0])) { // $rows = $val; // } +// } + +// $list = Cache::get(CacheVer::k('health:services')); +// if (empty($list)) { +// // Fallback: aus DB/Redis (persistiert vom Job) +// $list = \App\Support\Setting::get('woltguard.services', []); +// } +// +// $rows = []; +// if (is_array($list)) { +// // neues Format: ['ts'=>..., 'rows'=>[...]] +// if (isset($list['rows']) && is_array($list['rows'])) { +// $rows = $list['rows']; +// } +// // altes Format: direkt die Array-Liste +// elseif (isset($list[0]) && is_array($list[0])) { +// $rows = $list; +// } // } $list = Cache::get(CacheVer::k('health:services')); + if (empty($list)) { - // Fallback: aus DB/Redis (persistiert vom Job) + // Fallback: persistierter Wert aus DB/Redis $list = \App\Support\Setting::get('woltguard.services', []); } $rows = []; if (is_array($list)) { - // neues Format: ['ts'=>..., 'rows'=>[...]] - if (isset($list['rows']) && is_array($list['rows'])) { - $rows = $list['rows']; - } - // altes Format: direkt die Array-Liste - elseif (isset($list[0]) && is_array($list[0])) { - $rows = $list; - } + $rows = isset($list['rows']) && is_array($list['rows']) + ? $list['rows'] // neues Format + : (isset($list[0]) && is_array($list[0]) ? $list : []); // altes Format } $this->services = $rows;