From 79b1eeb93c7e432f74fde65b2ca6667ce3422810 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Apr 2026 20:44:56 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20ClamAV=20enable=20non-blocking=20?= =?UTF-8?q?=E2=80=93=20Hintergrund-Start=20+=20Poll=20alle=203s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - enable() startet Dienst via nohup im Hintergrund (kein Request-Timeout) - $starting=true → wire:poll.3s ruft pollStatus() auf - Overlay zeigt "ClamAV wird gestartet… lädt Viren-DB / bis 60s" - pollStatus() erkennt wenn Dienst läuft → Overlay weg, Erfolg-Banner Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/Security/ClamavManager.php | 24 +++++++++++++++---- .../ui/security/clamav-manager.blade.php | 14 +++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/Livewire/Ui/Security/ClamavManager.php b/app/Livewire/Ui/Security/ClamavManager.php index 0858029..ab1317b 100644 --- a/app/Livewire/Ui/Security/ClamavManager.php +++ b/app/Livewire/Ui/Security/ClamavManager.php @@ -19,6 +19,7 @@ class ClamavManager extends Component public string $lastError = ''; public string $lastSuccess = ''; public bool $installing = false; + public bool $starting = false; public function mount(): void { @@ -29,6 +30,7 @@ class ClamavManager extends Component { $this->lastError = ''; $this->lastSuccess = ''; + $this->starting = false; $this->running = $this->serviceActive(); $this->enabled = $this->serviceEnabled(); $this->installed = true; @@ -36,6 +38,18 @@ class ClamavManager extends Component [$this->dbDate, $this->dbVersion] = $this->readDbInfo(); } + public function pollStatus(): void + { + if (!$this->starting) return; + $this->running = $this->serviceActive(); + $this->enabled = $this->serviceEnabled(); + if ($this->running) { + $this->starting = false; + $this->lastSuccess = 'ClamAV wurde aktiviert und läuft.'; + $this->ramMb = $this->readRamMb(); + } + } + public function install(): void { $this->installing = true; @@ -53,11 +67,11 @@ class ClamavManager extends Component public function enable(): void { - [$ok, $msg] = $this->runCmd('enable'); - if ($ok) $this->lastSuccess = 'ClamAV wurde aktiviert und gestartet.'; - else $this->lastError = $msg; - $this->running = $this->serviceActive(); - $this->enabled = $this->serviceEnabled(); + $this->lastError = $this->lastSuccess = ''; + // Im Hintergrund starten – systemctl start kann 30-60s dauern (DB-Laden) + shell_exec('nohup sudo -n /usr/local/sbin/mailwolt-clamav enable > /tmp/mw-clamav-start.log 2>&1 &'); + $this->starting = true; + $this->enabled = true; // systemctl enable ist sofort wirksam } public function disable(): void diff --git a/resources/views/livewire/ui/security/clamav-manager.blade.php b/resources/views/livewire/ui/security/clamav-manager.blade.php index 3c64b81..e8a8d48 100644 --- a/resources/views/livewire/ui/security/clamav-manager.blade.php +++ b/resources/views/livewire/ui/security/clamav-manager.blade.php @@ -1,7 +1,7 @@ Sicherheit Virenschutz -
+
@@ -39,12 +39,18 @@ {{-- Status-Karte --}}
-
+
- ClamAV wird gestartet… ClamAV wird gestoppt… - ClamAV wird installiert… + ClamAV wird installiert… (ca. 1 Min.)
+ @if($starting) +
+ + ClamAV wird gestartet… (lädt Viren-DB) + Das kann bis zu 60 Sekunden dauern +
+ @endif
Status