From ecbe123088448ec190566e04c40e9989a477fc5f Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Oct 2025 18:00:40 +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/Security/SpamAvCard.php | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/app/Livewire/Ui/Security/SpamAvCard.php b/app/Livewire/Ui/Security/SpamAvCard.php index 577c797..ad924c7 100644 --- a/app/Livewire/Ui/Security/SpamAvCard.php +++ b/app/Livewire/Ui/Security/SpamAvCard.php @@ -70,14 +70,28 @@ class SpamAvCard extends Component $reject = preg_match('/\breject\s*:\s*(\d+)/i', $out, $m3) ? (int)$m3[1] : 0; // Versionen - $rspamdVer = trim(@shell_exec('rspamadm version 2>/dev/null') ?? '') ?: '–'; - $clamVer = trim(@shell_exec('clamd --version 2>/dev/null || clamscan --version 2>/dev/null') ?? '') ?: '–'; +// $rspamdVer = trim(@shell_exec('rspamadm version 2>/dev/null') ?? '') ?: '–'; +// $clamVer = trim(@shell_exec('clamd --version 2>/dev/null || clamscan --version 2>/dev/null') ?? '') ?: '–'; +// +// // Letztes Signatur-Update aus freshclam.log +// $sigUpdated = null; +// $log = @shell_exec('grep -i "Database updated" /var/log/clamav/freshclam.log | tail -n1 2>/dev/null'); +// if ($log) { +// $sigUpdated = trim($log); +// } - // Letztes Signatur-Update aus freshclam.log + $clamLine = trim(shell_exec('clamd --version 2>/dev/null || clamscan --version 2>/dev/null') ?? ''); + $clamVer = $clamLine ?: '–'; $sigUpdated = null; - $log = @shell_exec('grep -i "Database updated" /var/log/clamav/freshclam.log | tail -n1 2>/dev/null'); - if ($log) { - $sigUpdated = trim($log); + if ($clamLine && preg_match('#/([^/]+ [0-9]{2} [0-9:]{8} [0-9]{4})$#', $clamLine, $m)) { + // Beispiel-Match: "Sun Oct 26 09:42:43 2025" + $sigUpdated = $m[1]; + } + +// Fallback: Versuch über journalctl (falls adm-Rechte vorhanden) + if (!$sigUpdated) { + $jl = trim(shell_exec('journalctl -u freshclam -n 50 --no-pager 2>/dev/null | grep -i "Database updated" | tail -n1') ?? ''); + if ($jl) $sigUpdated = $jl; } return [ @@ -85,7 +99,7 @@ class SpamAvCard extends Component 'ham' => $ham, 'spam' => $spam, 'reject' => $reject, - 'rspamdVer' => $rspamdVer, + 'clamLine' => $clamLine, 'clamVer' => $clamVer, 'sigUpdated' => $sigUpdated, ];