Fix: ClamAV enable() – kein Spinner mehr, einfache Textmeldung

$starting-Property, pollStatus() und wire:poll entfernt.
enable() startet ClamAV im Hintergrund und zeigt nur eine
Info-Meldung an – kein dauerhafter Spinner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.332
boban 2026-04-26 20:53:35 +02:00
parent 0fc6ee81d6
commit 673e9ec1df
2 changed files with 15 additions and 35 deletions

View File

@ -10,16 +10,15 @@ use Livewire\Component;
#[Title('Virenschutz · Mailwolt')]
class ClamavManager extends Component
{
public bool $installed = false;
public bool $running = false;
public bool $enabled = false;
public string $dbDate = '—';
public string $dbVersion = '—';
public ?int $ramMb = null;
public string $lastError = '';
public string $lastSuccess = '';
public bool $installing = false;
public bool $starting = false;
public bool $installed = false;
public bool $running = false;
public bool $enabled = false;
public string $dbDate = '—';
public string $dbVersion = '—';
public ?int $ramMb = null;
public string $lastError = '';
public string $lastSuccess = '';
public bool $installing = false;
public function mount(): void
{
@ -30,7 +29,6 @@ class ClamavManager extends Component
{
$this->lastError = '';
$this->lastSuccess = '';
$this->starting = false;
$this->running = $this->serviceActive();
$this->enabled = $this->serviceEnabled();
$this->installed = true;
@ -38,18 +36,6 @@ 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;
@ -67,11 +53,11 @@ class ClamavManager extends Component
public function enable(): void
{
$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
$this->lastError = '';
$this->lastSuccess = '';
@exec('sudo -n /usr/local/sbin/mailwolt-clamav enable > /tmp/mw-clamav-start.log 2>&1 &');
$this->enabled = true;
$this->lastSuccess = 'ClamAV wird gestartet… Dies kann bis zu 60 Sekunden dauern. Klicken Sie danach auf „Aktualisieren".';
}
public function disable(): void

View File

@ -44,13 +44,7 @@
<span style="font-size:12.5px;color:#e2d9fa;font-weight:500" wire:loading wire:target="disable">ClamAV wird gestoppt…</span>
<span style="font-size:12.5px;color:#e2d9fa;font-weight:500" wire:loading wire:target="install">ClamAV wird installiert… (ca. 1 Min.)</span>
</div>
@if($starting)
<div wire:poll.3s="pollStatus" style="position:absolute;inset:0;background:rgba(0,0,0,.45);border-radius:11px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;z-index:10">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" style="color:#a78bfa;animation:spin 1s linear infinite"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
<span style="font-size:12.5px;color:#e2d9fa;font-weight:500">ClamAV wird gestartet… (lädt Viren-DB)</span>
<span style="font-size:11px;color:rgba(226,217,250,.6)">Das kann bis zu 60 Sekunden dauern</span>
</div>
@endif
<div class="mbx-domain-head">
<div class="mbx-domain-info">
<span class="mbx-badge-mute">Status</span>