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