mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-14 01:30:19 +00:00
Make isClamavEnabled an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
bebae7069b
commit
f8a244bee2
5 changed files with 10 additions and 24 deletions
|
|
@ -110,7 +110,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
|
||||||
'last_backup_time' => $configurationManager->GetLastBackupTime(),
|
'last_backup_time' => $configurationManager->GetLastBackupTime(),
|
||||||
'backup_times' => $configurationManager->GetBackupTimes(),
|
'backup_times' => $configurationManager->GetBackupTimes(),
|
||||||
'current_channel' => $dockerActionManager->GetCurrentChannel(),
|
'current_channel' => $dockerActionManager->GetCurrentChannel(),
|
||||||
'is_clamav_enabled' => $configurationManager->isClamavEnabled(),
|
'is_clamav_enabled' => $configurationManager->isClamavEnabled,
|
||||||
'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled(),
|
'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled(),
|
||||||
'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(),
|
'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(),
|
||||||
'is_talk_enabled' => $configurationManager->isTalkEnabled(),
|
'is_talk_enabled' => $configurationManager->isTalkEnabled(),
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ readonly class ContainerDefinitionFetcher {
|
||||||
$containers = [];
|
$containers = [];
|
||||||
foreach ($data['aio_services_v1'] as $entry) {
|
foreach ($data['aio_services_v1'] as $entry) {
|
||||||
if ($entry['container_name'] === 'nextcloud-aio-clamav') {
|
if ($entry['container_name'] === 'nextcloud-aio-clamav') {
|
||||||
if (!$this->configurationManager->isClamavEnabled()) {
|
if (!$this->configurationManager->isClamavEnabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} elseif ($entry['container_name'] === 'nextcloud-aio-onlyoffice') {
|
} elseif ($entry['container_name'] === 'nextcloud-aio-onlyoffice') {
|
||||||
|
|
@ -168,7 +168,7 @@ readonly class ContainerDefinitionFetcher {
|
||||||
}
|
}
|
||||||
foreach ($valueDependsOn as $value) {
|
foreach ($valueDependsOn as $value) {
|
||||||
if ($value === 'nextcloud-aio-clamav') {
|
if ($value === 'nextcloud-aio-clamav') {
|
||||||
if (!$this->configurationManager->isClamavEnabled()) {
|
if (!$this->configurationManager->isClamavEnabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} elseif ($value === 'nextcloud-aio-onlyoffice') {
|
} elseif ($value === 'nextcloud-aio-onlyoffice') {
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,7 @@ readonly class ConfigurationController {
|
||||||
$this->configurationManager->SetCollaboraEnabledState(0);
|
$this->configurationManager->SetCollaboraEnabledState(0);
|
||||||
$this->configurationManager->SetOnlyofficeEnabledState(0);
|
$this->configurationManager->SetOnlyofficeEnabledState(0);
|
||||||
}
|
}
|
||||||
|
$this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']);
|
||||||
if (isset($request->getParsedBody()['clamav'])) {
|
|
||||||
$this->configurationManager->SetClamavEnabledState(1);
|
|
||||||
} else {
|
|
||||||
$this->configurationManager->SetClamavEnabledState(0);
|
|
||||||
}
|
}
|
||||||
if (isset($request->getParsedBody()['talk'])) {
|
if (isset($request->getParsedBody()['talk'])) {
|
||||||
$this->configurationManager->SetTalkEnabledState(1);
|
$this->configurationManager->SetTalkEnabledState(1);
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ class ConfigurationManager
|
||||||
set { $this->set('install_latest_major', $value); }
|
set { $this->set('install_latest_major', $value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool $isClamavEnabled {
|
||||||
|
get => $this->get('isClamavEnabled', false);
|
||||||
|
set { $this->set('isClamavEnabled', $value); }
|
||||||
|
}
|
||||||
|
|
||||||
public function GetConfig() : array
|
public function GetConfig() : array
|
||||||
{
|
{
|
||||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||||
|
|
@ -203,21 +208,6 @@ class ConfigurationManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isClamavEnabled() : bool {
|
|
||||||
$config = $this->GetConfig();
|
|
||||||
if (isset($config['isClamavEnabled']) && $config['isClamavEnabled'] === 1) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function SetClamavEnabledState(int $value) : void {
|
|
||||||
$config = $this->GetConfig();
|
|
||||||
$config['isClamavEnabled'] = $value;
|
|
||||||
$this->WriteConfig($config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isImaginaryEnabled() : bool {
|
public function isImaginaryEnabled() : bool {
|
||||||
$config = $this->GetConfig();
|
$config = $this->GetConfig();
|
||||||
if (isset($config['isImaginaryEnabled']) && $config['isImaginaryEnabled'] === 0) {
|
if (isset($config['isImaginaryEnabled']) && $config['isImaginaryEnabled'] === 0) {
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,7 @@ readonly class DockerActionManager {
|
||||||
'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(),
|
'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(),
|
||||||
'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(),
|
'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(),
|
||||||
'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(),
|
'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(),
|
||||||
'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled() ? 'yes' : '',
|
'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '',
|
||||||
'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled() ? 'yes' : '',
|
'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled() ? 'yes' : '',
|
||||||
'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled() ? 'yes' : '',
|
'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled() ? 'yes' : '',
|
||||||
'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled() ? 'yes' : '',
|
'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled() ? 'yes' : '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue