Fix: isInstalled() prüft systemd-Unit statt Binary-Pfade

Zuverlässiger auf Servern wo PHP-FPM keinen Zugriff auf /usr/bin hat.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.326
boban 2026-04-26 20:33:37 +02:00
parent 6fa77f9f9b
commit 7d738392b2
1 changed files with 14 additions and 2 deletions

View File

@ -94,8 +94,20 @@ class ClamavManager extends Component
private function isInstalled(): bool
{
return is_executable('/usr/bin/clamscan') || is_executable('/usr/sbin/clamd')
|| @file_exists('/usr/sbin/clamd') || @file_exists('/usr/bin/clamdscan');
// Systemd-Unit ist zuverlässiger als Binary-Pfade (keine exec-Rechte nötig)
$unitPaths = [
'/lib/systemd/system/clamav-daemon.service',
'/usr/lib/systemd/system/clamav-daemon.service',
'/etc/systemd/system/clamav-daemon.service',
];
foreach ($unitPaths as $p) {
if (@file_exists($p)) return true;
}
// Fallback: bekannte Binary-Pfade
foreach (['/usr/bin/clamscan', '/usr/bin/clamdscan', '/usr/sbin/clamd', '/bin/clamscan'] as $b) {
if (@file_exists($b)) return true;
}
return false;
}
private function serviceActive(): bool