From 172ae49cdf8a9f379ed0317e3ea49a2e98e2121c Mon Sep 17 00:00:00 2001 From: szaimen Date: Wed, 16 Mar 2022 14:29:30 +0100 Subject: [PATCH] improve/fix some things Signed-off-by: szaimen --- php/containers.json | 8 +++++++- php/psalm-baseline.xml | 6 ++++-- php/public/disable-clamav.js | 3 ++- php/src/Controller/ConfigurationController.php | 9 +++------ php/templates/containers.twig | 7 ++++--- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/php/containers.json b/php/containers.json index c5a6ef6c..756cd987 100644 --- a/php/containers.json +++ b/php/containers.json @@ -306,7 +306,13 @@ "3310" ], "environmentVariables": [], - "volumes": [], + "volumes": [ + { + "name": "nextcloud_aio_clamav", + "location": "/var/lib/clamav", + "writeable": true + } + ], "secrets": [], "maxShutdownTime": 10, "restartPolicy": "unless-stopped" diff --git a/php/psalm-baseline.xml b/php/psalm-baseline.xml index f0469f61..682b5c8b 100644 --- a/php/psalm-baseline.xml +++ b/php/psalm-baseline.xml @@ -18,19 +18,21 @@ $args - + $request->getParsedBody()['borg_backup_host_location'] $request->getParsedBody()['domain'] $request->getParsedBody()['clamav'] + $request->getParsedBody()['options-form'] $request->getParsedBody()['borg_backup_host_location'] $request->getParsedBody()['domain'] - + $request->getParsedBody()['borg_backup_host_location'] $request->getParsedBody()['domain'] $request->getParsedBody()['clamav'] + $request->getParsedBody()['options-form'] diff --git a/php/public/disable-clamav.js b/php/public/disable-clamav.js index f0c0f11c..ae2d003c 100644 --- a/php/public/disable-clamav.js +++ b/php/public/disable-clamav.js @@ -1,4 +1,5 @@ document.addEventListener("DOMContentLoaded", function(event) { // Clamav - document.getElementById("clamav").disabled = true; + var clamav = document.getElementById("clamav"); + clamav.disabled = true; }); \ No newline at end of file diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index cfd2070f..78261ad4 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -35,14 +35,11 @@ class ConfigurationController $this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']); } - if (isset($request->getParsedBody()['clamav'])) { - $value = $request->getParsedBody()['clamav']; - if ($value === 'on') { + if (isset($request->getParsedBody()['options-form'])) { + if (isset($request->getParsedBody()['clamav'])) { $this->configurationManager->SetClamavEnabledState(1); - } elseif ($value === 'off') { - $this->configurationManager->SetClamavEnabledState(0); } else { - error_log('It seems like clamav was changed but not to on or off.'); + $this->configurationManager->SetClamavEnabledState(0); } } diff --git a/php/templates/containers.twig b/php/templates/containers.twig index c32862ff..c9fa9e0d 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -293,15 +293,16 @@
+ {% if is_clamav_enabled == true %} - + {% else %} - + {% endif %}
{% if isAnyRunning == true or is_x64_platform == false %} - + {% endif %} {% endif %} {% endif %}