From 3f6f787fd353e0ac010ded0404c93f3e341e08a7 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Apr 2026 21:11:55 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20ClamAV=20starting-State=20=C3=BCberlebt?= =?UTF-8?q?=20Reload=20+=20kein=20false-dirty=20bei=20untracked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flag-Datei /tmp/mw-clamav-starting speichert Startzeitpunkt sodass Spinner + Timer auch nach Seitenreload korrekt weiterläuft. git_dirty_check filtert jetzt untracked Dateien (??) heraus damit mailwolt-installer/ und ähnliche nicht fälschlich als dirty gelten. Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/Security/ClamavManager.php | 23 +++++++++++++++++++++- scripts/update.sh | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Ui/Security/ClamavManager.php b/app/Livewire/Ui/Security/ClamavManager.php index 9733148..a5eb697 100644 --- a/app/Livewire/Ui/Security/ClamavManager.php +++ b/app/Livewire/Ui/Security/ClamavManager.php @@ -23,9 +23,28 @@ class ClamavManager extends Component public bool $starting = false; public int $startSecs = 0; + private const STARTING_FLAG = '/tmp/mw-clamav-starting'; + public function mount(): void { $this->refresh(); + $this->restoreStartingState(); + } + + private function restoreStartingState(): void + { + if (!file_exists(self::STARTING_FLAG)) return; + if ($this->running) { + @unlink(self::STARTING_FLAG); + return; + } + $elapsed = time() - (int) @file_get_contents(self::STARTING_FLAG); + if ($elapsed > 180) { + @unlink(self::STARTING_FLAG); + return; + } + $this->starting = true; + $this->startSecs = max(0, $elapsed); } public function refresh(): void @@ -56,8 +75,9 @@ class ClamavManager extends Component public function enable(): void { - $this->lastError = ''; + $this->lastError = ''; $this->lastSuccess = ''; + file_put_contents(self::STARTING_FLAG, time()); ClamavEnable::dispatch(); $this->enabled = true; $this->starting = true; @@ -70,6 +90,7 @@ class ClamavManager extends Component $this->startSecs += 3; $this->running = $this->serviceActive(); if ($this->running) { + @unlink(self::STARTING_FLAG); $this->starting = false; $this->startSecs = 0; $this->enabled = $this->serviceEnabled(); diff --git a/scripts/update.sh b/scripts/update.sh index 74c1dac..398fa55 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -75,8 +75,9 @@ git_safe(){ git_dirty_check(){ # Als root ausführen: kein Permission-Problem unabhängig vom Dateieigentümer + # Nur tracked Änderungen prüfen – untracked Dateien (??) ignorieren local dirty - dirty="$(git -C "${APP_DIR}" status --porcelain 2>/dev/null || true)" + dirty="$(git -C "${APP_DIR}" status --porcelain 2>/dev/null | grep -v '^??' || true)" if [[ -n "$dirty" ]]; then echo "[!] Uncommitted Änderungen — tracked Dateien werden zurückgesetzt:" echo "$dirty"