Make isFulltextsearchEnabled an attribute

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl 2026-01-19 12:04:48 +01:00
parent a58c41e750
commit 6767fcfc8a
5 changed files with 11 additions and 29 deletions

View file

@ -125,7 +125,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(),
'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(),
'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled,
'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled(), 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled,
'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(),
'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(),
'nextcloud_mount' => $configurationManager->GetNextcloudMount(), 'nextcloud_mount' => $configurationManager->GetNextcloudMount(),

View file

@ -83,7 +83,7 @@ readonly class ContainerDefinitionFetcher {
continue; continue;
} }
} elseif ($entry['container_name'] === 'nextcloud-aio-fulltextsearch') { } elseif ($entry['container_name'] === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) { if (!$this->configurationManager->isFulltextsearchEnabled) {
continue; continue;
} }
} elseif ($entry['container_name'] === 'nextcloud-aio-docker-socket-proxy') { } elseif ($entry['container_name'] === 'nextcloud-aio-docker-socket-proxy') {
@ -192,7 +192,7 @@ readonly class ContainerDefinitionFetcher {
continue; continue;
} }
} elseif ($value === 'nextcloud-aio-fulltextsearch') { } elseif ($value === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) { if (!$this->configurationManager->isFulltextsearchEnabled) {
continue; continue;
} }
} elseif ($value === 'nextcloud-aio-docker-socket-proxy') { } elseif ($value === 'nextcloud-aio-docker-socket-proxy') {

View file

@ -85,11 +85,7 @@ readonly class ConfigurationController {
$this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']); $this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']);
$this->configurationManager->isTalkRecordingEnabled = isset($request->getParsedBody()['talk-recording']); $this->configurationManager->isTalkRecordingEnabled = isset($request->getParsedBody()['talk-recording']);
$this->configurationManager->isImaginaryEnabled = isset($request->getParsedBody()['imaginary']); $this->configurationManager->isImaginaryEnabled = isset($request->getParsedBody()['imaginary']);
if (isset($request->getParsedBody()['fulltextsearch'])) { $this->configurationManager->isFulltextsearchEnabled = isset($request->getParsedBody()['fulltextsearch']);
$this->configurationManager->SetFulltextsearchEnabledState(1);
} else {
$this->configurationManager->SetFulltextsearchEnabledState(0);
}
$this->configurationManager->isDockerSocketProxyEnabled = isset($request->getParsedBody()['docker-socket-proxy']); $this->configurationManager->isDockerSocketProxyEnabled = isset($request->getParsedBody()['docker-socket-proxy']);
$this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']); $this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']);
} }

View file

@ -98,6 +98,12 @@ class ConfigurationManager
set { $this->set('isImaginaryEnabled', $value); } set { $this->set('isImaginaryEnabled', $value); }
} }
public bool $isFulltextsearchEnabled {
get => $this->get('isFulltextsearchEnabled', false);
// Elasticsearch does not work on kernels without seccomp anymore. See https://github.com/nextcloud/all-in-one/discussions/5768
set { $this->set('isFulltextsearchEnabled', ($this->isSeccompDisabled() && $value)); }
}
public function GetConfig() : array public function GetConfig() : array
{ {
if ($this->config === [] && file_exists(DataConst::GetConfigFile())) if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
@ -233,26 +239,6 @@ class ConfigurationManager
} }
} }
public function isFulltextsearchEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isFulltextsearchEnabled']) && $config['isFulltextsearchEnabled'] === 1) {
return true;
} else {
return false;
}
}
public function SetFulltextsearchEnabledState(int $value) : void {
// Elasticsearch does not work on kernels without seccomp anymore. See https://github.com/nextcloud/all-in-one/discussions/5768
if ($this->isSeccompDisabled()) {
$value = 0;
}
$config = $this->GetConfig();
$config['isFulltextsearchEnabled'] = $value;
$this->WriteConfig($config);
}
/** /**
* @throws InvalidSettingConfigurationException * @throws InvalidSettingConfigurationException
*/ */

View file

@ -580,7 +580,7 @@ readonly class DockerActionManager {
'TIMEZONE' => $this->configurationManager->GetTimezone() === '' ? 'Etc/UTC' : $this->configurationManager->GetTimezone(), 'TIMEZONE' => $this->configurationManager->GetTimezone() === '' ? 'Etc/UTC' : $this->configurationManager->GetTimezone(),
'COLLABORA_DICTIONARIES' => $this->configurationManager->GetCollaboraDictionaries() === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->configurationManager->GetCollaboraDictionaries(), 'COLLABORA_DICTIONARIES' => $this->configurationManager->GetCollaboraDictionaries() === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->configurationManager->GetCollaboraDictionaries(),
'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '', 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '',
'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled() ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '',
'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '',
'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->GetNextcloudUploadLimit(), 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->GetNextcloudUploadLimit(),
'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(), 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(),