From 0b6c0733ab996a3141b0afebb794f40c5c290cfe Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Wed, 7 Jan 2026 17:29:24 +0100 Subject: [PATCH 01/92] Cache config, introduce get() and set() helpers to guide new way to set attributes Use cached config, use set() for single attributes, setMultiple to wrap multiple calls to set() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 50 ++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 320bc477..3b09c5b3 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -9,15 +9,19 @@ class ConfigurationManager { private array $secrets = []; + private array $config = []; + + private bool $noWrite = false; + public function GetConfig() : array { - if(file_exists(DataConst::GetConfigFile())) + if ($this->config === [] && file_exists(DataConst::GetConfigFile())) { $configContent = (string)file_get_contents(DataConst::GetConfigFile()); - return json_decode($configContent, true, 512, JSON_THROW_ON_ERROR); + $this->config = json_decode($configContent, true, 512, JSON_THROW_ON_ERROR); } - return []; + return $this->config; } public function GetPassword() : string { @@ -34,6 +38,34 @@ class ConfigurationManager $this->WriteConfig($config); } + private function get(string $key, mixed $fallbackValue = null) : mixed { + return $this->GetConfig()[$key] ?? $fallbackValue; + } + + private function set(string $key, mixed $value) : void { + $this->GetConfig(); + $this->config[$key] = $value; + // Only write if this isn't called via setMultiple(). + if ($this->noWrite !== true) { + $this->WriteConfig(); + } + } + + /** + * This allows to assign multiple attributes without saving the config to disk in between (as would + * calling set() do). + */ + public function setMultiple(\Closure $closure) : void { + $this->noWrite = true; + try { + $this->GetConfig(); + $closure($this); + $this->WriteConfig(); + } finally { + $this->noWrite = false; + } + } + public function GetAndGenerateSecret(string $secretId) : string { if ($secretId === '') { return ''; @@ -599,17 +631,25 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException */ - public function WriteConfig(array $config) : void { + public function WriteConfig(?array $config) : void { + if ($config) { + $this->config = $config; + } if(!is_dir(DataConst::GetDataDirectory())) { throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!"); } + // Shouldn't happen, but as a precaution we won't write an empty config to disk. + if ($this->config === []) { + return; + } $df = disk_free_space(DataConst::GetDataDirectory()); - $content = json_encode($config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); + $content = json_encode($this->config, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); $size = strlen($content) + 10240; if ($df !== false && (int)$df < $size) { throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not have enough space for writing the config file! Not writing it back!"); } file_put_contents(DataConst::GetConfigFile(), $content); + $this->config = []; } private function GetEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string { From 21b14a4a5df379f7ed457f9185faf94323c737fb Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 11:43:43 +0100 Subject: [PATCH 02/92] Adapt GetEnvironmentalVariableOrConfig() to get() and set() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 3b09c5b3..0ee4bae2 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -654,23 +654,21 @@ class ConfigurationManager private function GetEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string { $envVariableOutput = getenv($envVariableName); + $configValue = $this->get($configName, ''); if ($envVariableOutput === false) { - $config = $this->GetConfig(); - if (!isset($config[$configName]) || $config[$configName] === '') { - $config[$configName] = $defaultValue; + if ($configValue === '') { + $this->set($configName, $defaultValue); + return $defaultValue; } - return $config[$configName]; + return $configValue; } - if(file_exists(DataConst::GetConfigFile())) { - $config = $this->GetConfig(); - if (!isset($config[$configName])) { - $config[$configName] = ''; - } - if ($envVariableOutput !== $config[$configName]) { - $config[$configName] = $envVariableOutput; - $this->WriteConfig($config); + + if (file_exists(DataConst::GetConfigFile())) { + if ($envVariableOutput !== $configValue) { + $this->set($configName, $envVariableOutput); } } + return $envVariableOutput; } From a9b648e18fcfd6bd973b13c2dbca19b2260054d8 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 18:22:40 +0100 Subject: [PATCH 03/92] Adapt GetAndGenerateSecret() to get() and set() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 0ee4bae2..27a98d03 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -71,17 +71,17 @@ class ConfigurationManager return ''; } - $config = $this->GetConfig(); - if(!isset($config['secrets'][$secretId])) { - $config['secrets'][$secretId] = bin2hex(random_bytes(24)); - $this->WriteConfig($config); + $secrets = $this->get('secrets', []); + if (!isset($secrets[$secretId])) { + $secrets[$secretId] = bin2hex(random_bytes(24)); + $this->set('secrets', $secrets); } if ($secretId === 'BORGBACKUP_PASSWORD' && !file_exists(DataConst::GetBackupSecretFile())) { - $this->DoubleSafeBackupSecret($config['secrets'][$secretId]); + $this->DoubleSafeBackupSecret($secrets[$secretId]); } - return $config['secrets'][$secretId]; + return $secrets[$secretId]; } public function GetRegisteredSecret(string $secretId) : string { From b2f992d955d26c10bba639bae89ff4156a74899c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:37:36 +0100 Subject: [PATCH 04/92] Make `AIO_TOKEN` an attribute Signed-off-by: Pablo Zmdl --- php/src/Auth/AuthManager.php | 2 +- php/src/Controller/DockerController.php | 5 +---- php/src/Data/ConfigurationManager.php | 9 +++++---- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/php/src/Auth/AuthManager.php b/php/src/Auth/AuthManager.php index 925ff89f..b4533c1e 100644 --- a/php/src/Auth/AuthManager.php +++ b/php/src/Auth/AuthManager.php @@ -19,7 +19,7 @@ readonly class AuthManager { } public function CheckToken(string $token) : bool { - return hash_equals($this->configurationManager->GetToken(), $token); + return hash_equals($this->configurationManager->AIO_TOKEN, $token); } public function SetAuthState(bool $isLoggedIn) : void { diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index a924e61f..ab10d3c6 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -213,10 +213,7 @@ readonly class DockerController { } public function startTopContainer(bool $pullImage) : void { - $config = $this->configurationManager->GetConfig(); - // set AIO_TOKEN - $config['AIO_TOKEN'] = bin2hex(random_bytes(24)); - $this->configurationManager->WriteConfig($config); + $this->configurationManager->AIO_TOKEN = bin2hex(random_bytes(24)); // Stop domaincheck since apache would not be able to start otherwise $this->StopDomaincheckContainer(); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 27a98d03..6b80c71b 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -13,6 +13,11 @@ class ConfigurationManager private bool $noWrite = false; + public string $AIO_TOKEN { + get => $this->get('AIO_TOKEN', ''); + set { $this->set('AIO_TOKEN', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -28,10 +33,6 @@ class ConfigurationManager return $this->GetConfig()['password']; } - public function GetToken() : string { - return $this->GetConfig()['AIO_TOKEN']; - } - public function SetPassword(string $password) : void { $config = $this->GetConfig(); $config['password'] = $password; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index fb3701a4..ae957d35 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -559,7 +559,7 @@ readonly class DockerActionManager { return match ($placeholder) { 'NC_DOMAIN' => $this->configurationManager->GetDomain(), 'NC_BASE_DN' => $this->configurationManager->GetBaseDN(), - 'AIO_TOKEN' => $this->configurationManager->GetToken(), + 'AIO_TOKEN' => $this->configurationManager->AIO_TOKEN, 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(), 'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(), 'AIO_URL' => $this->configurationManager->GetAIOURL(), From 4d8e959608c9c1be21b337bb19b89656e478d8ec Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 14:55:29 +0100 Subject: [PATCH 05/92] Make `password` an attribute Signed-off-by: Pablo Zmdl --- php/src/Auth/AuthManager.php | 2 +- php/src/Data/ConfigurationManager.php | 19 +++++++------------ php/src/Data/Setup.php | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/php/src/Auth/AuthManager.php b/php/src/Auth/AuthManager.php index b4533c1e..1d558aed 100644 --- a/php/src/Auth/AuthManager.php +++ b/php/src/Auth/AuthManager.php @@ -15,7 +15,7 @@ readonly class AuthManager { } public function CheckCredentials(string $password) : bool { - return hash_equals($this->configurationManager->GetPassword(), $password); + return hash_equals($this->configurationManager->password, $password); } public function CheckToken(string $token) : bool { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 6b80c71b..1c40508f 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -18,6 +18,11 @@ class ConfigurationManager set { $this->set('AIO_TOKEN', $value); } } + public string $password { + get => $this->get('password', ''); + set { $this->set('password', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -29,16 +34,6 @@ class ConfigurationManager return $this->config; } - public function GetPassword() : string { - return $this->GetConfig()['password']; - } - - public function SetPassword(string $password) : void { - $config = $this->GetConfig(); - $config['password'] = $password; - $this->WriteConfig($config); - } - private function get(string $key, mixed $fallbackValue = null) : mixed { return $this->GetConfig()[$key] ?? $fallbackValue; } @@ -586,7 +581,7 @@ class ConfigurationManager throw new InvalidSettingConfigurationException("Please enter your current password."); } - if ($currentPassword !== $this->GetPassword()) { + if ($currentPassword !== $this->password) { throw new InvalidSettingConfigurationException("The entered current password is not correct."); } @@ -603,7 +598,7 @@ class ConfigurationManager } // All checks pass so set the password - $this->SetPassword($newPassword); + $this->set('password', $newPassword); } public function GetApachePort() : string { diff --git a/php/src/Data/Setup.php b/php/src/Data/Setup.php index f8f43e4b..e409eef8 100644 --- a/php/src/Data/Setup.php +++ b/php/src/Data/Setup.php @@ -17,7 +17,7 @@ readonly class Setup { } $password = $this->passwordGenerator->GeneratePassword(8); - $this->configurationManager->SetPassword($password); + $this->configurationManager->password = $password; return $password; } From 484ff7994319838736570ad8e7b900bb9580c9e6 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:11:20 +0100 Subject: [PATCH 06/92] Make `wasStartButtonClicked` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/DockerController.php | 6 +++--- php/src/Data/ConfigurationManager.php | 13 +++++-------- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index b57f65a5..59708627 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -105,7 +105,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(), 'is_instance_restore_attempt' => $configurationManager->isInstanceRestoreAttempt(), 'borg_backup_mode' => $configurationManager->GetBackupMode(), - 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked(), + 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked, 'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(), 'last_backup_time' => $configurationManager->GetLastBackupTime(), 'backup_times' => $configurationManager->GetBackupTimes(), diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index ab10d3c6..e913349d 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -190,11 +190,11 @@ readonly class DockerController { $config = $this->configurationManager->GetConfig(); // set AIO_URL $config['AIO_URL'] = $host . ':' . (string)$port . $path; - // set wasStartButtonClicked - $config['wasStartButtonClicked'] = 1; // set install_latest_major $config['install_latest_major'] = $installLatestMajor; $this->configurationManager->WriteConfig($config); + // set wasStartButtonClicked + $this->configurationManager->wasStartButtonClicked = true; // Do not pull container images in case 'bypass_container_update' is set via url params // Needed for local testing @@ -274,7 +274,7 @@ readonly class DockerController { public function StartDomaincheckContainer() : void { # Don't start if domain is already set - if ($this->configurationManager->GetDomain() !== '' || $this->configurationManager->wasStartButtonClicked()) { + if ($this->configurationManager->GetDomain() !== '' || $this->configurationManager->wasStartButtonClicked) { return; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 1c40508f..18cdc46c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public bool $wasStartButtonClicked { + get => $this->get('wasStartButtonClicked', false); + set { $this->set('wasStartButtonClicked', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -150,14 +155,6 @@ class ConfigurationManager return $backupTimes; } - public function wasStartButtonClicked() : bool { - if (isset($this->GetConfig()['wasStartButtonClicked'])) { - return true; - } else { - return false; - } - } - private function isx64Platform() : bool { if (php_uname('m') === 'x86_64') { return true; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index ae957d35..42c2d5f0 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -621,7 +621,7 @@ readonly class DockerActionManager { public function isAnyUpdateAvailable(): bool { // return early if instance is not installed - if (!$this->configurationManager->wasStartButtonClicked()) { + if (!$this->configurationManager->wasStartButtonClicked) { return false; } $id = 'nextcloud-aio-apache'; From 06fdf31c8707b6edee57fc93efdbf16930434320 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:09:52 +0100 Subject: [PATCH 07/92] Make `AIO_URL` an attribute Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 4 ++-- php/src/Data/ConfigurationManager.php | 14 +++++--------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index e913349d..b8f89c46 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -188,11 +188,11 @@ readonly class DockerController { } $config = $this->configurationManager->GetConfig(); - // set AIO_URL - $config['AIO_URL'] = $host . ':' . (string)$port . $path; // set install_latest_major $config['install_latest_major'] = $installLatestMajor; $this->configurationManager->WriteConfig($config); + // set AIO_URL + $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; // set wasStartButtonClicked $this->configurationManager->wasStartButtonClicked = true; diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 18cdc46c..c4032fea 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public string $AIO_URL { + get => $this->get('AIO_URL', ''); + set { $this->set('AIO_URL', $value); } + } + public bool $wasStartButtonClicked { get => $this->get('wasStartButtonClicked', false); set { $this->set('wasStartButtonClicked', $value); } @@ -475,15 +480,6 @@ class ConfigurationManager return $config['restore-exclude-previews']; } - public function GetAIOURL() : string { - $config = $this->GetConfig(); - if(!isset($config['AIO_URL'])) { - $config['AIO_URL'] = ''; - } - - return $config['AIO_URL']; - } - /** * @throws InvalidSettingConfigurationException */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 42c2d5f0..7ef920e7 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -562,7 +562,7 @@ readonly class DockerActionManager { 'AIO_TOKEN' => $this->configurationManager->AIO_TOKEN, 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(), 'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(), - 'AIO_URL' => $this->configurationManager->GetAIOURL(), + 'AIO_URL' => $this->configurationManager->AIO_URL, 'SELECTED_RESTORE_TIME' => $this->configurationManager->GetSelectedRestoreTime(), 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->GetRestoreExcludePreviews(), 'APACHE_PORT' => $this->configurationManager->GetApachePort(), From 1d11a4682b3f03200f2e22b413ffb76424464a78 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:06:59 +0100 Subject: [PATCH 08/92] Make `install_latest_major` an attribute Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 11 +---------- php/src/Data/ConfigurationManager.php | 13 +++++-------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index b8f89c46..f8f2896a 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -181,16 +181,7 @@ readonly class DockerController { $port = 443; } - if (isset($request->getParsedBody()['install_latest_major'])) { - $installLatestMajor = 32; - } else { - $installLatestMajor = ""; - } - - $config = $this->configurationManager->GetConfig(); - // set install_latest_major - $config['install_latest_major'] = $installLatestMajor; - $this->configurationManager->WriteConfig($config); + $this->configurationManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); // set AIO_URL $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; // set wasStartButtonClicked diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index c4032fea..1fb03e68 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -33,6 +33,11 @@ class ConfigurationManager set { $this->set('wasStartButtonClicked', $value); } } + public bool $install_latest_major { + get => $this->get('install_latest_major', false); + set { $this->set('install_latest_major', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -889,14 +894,6 @@ class ConfigurationManager } } - public function shouldLatestMajorGetInstalled() : bool { - $config = $this->GetConfig(); - if(!isset($config['install_latest_major'])) { - $config['install_latest_major'] = ''; - } - return $config['install_latest_major'] !== ''; - } - public function GetAdditionalBackupDirectoriesString() : string { if (!file_exists(DataConst::GetAdditionalBackupDirectoriesFile())) { return ''; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 7ef920e7..1c6c418e 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -595,7 +595,7 @@ readonly class DockerActionManager { 'NEXTCLOUD_STARTUP_APPS' => $this->configurationManager->GetNextcloudStartupApps(), 'NEXTCLOUD_ADDITIONAL_APKS' => $this->configurationManager->GetNextcloudAdditionalApks(), 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->configurationManager->GetNextcloudAdditionalPhpExtensions(), - 'INSTALL_LATEST_MAJOR' => $this->configurationManager->shouldLatestMajorGetInstalled() ? 'yes' : '', + 'INSTALL_LATEST_MAJOR' => $this->configurationManager->install_latest_major ? 'yes' : '', 'REMOVE_DISABLED_APPS' => $this->configurationManager->shouldDisabledAppsGetRemoved() ? 'yes' : '', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), From b8130958c557b05499736c32aaa6808a9bd5b8b1 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:05:10 +0100 Subject: [PATCH 09/92] Make `selectedRestoreTime` an attribute Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 4 +--- php/src/Data/ConfigurationManager.php | 14 +++++--------- php/src/Docker/DockerActionManager.php | 1 + 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index f8f2896a..1848ccab 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -124,14 +124,12 @@ readonly class DockerController { public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { $this->configurationManager->SetBackupMode('restore'); - $config = $this->configurationManager->GetConfig(); - $config['selected-restore-time'] = $request->getParsedBody()['selected_restore_time'] ?? ''; if (isset($request->getParsedBody()['restore-exclude-previews'])) { $config['restore-exclude-previews'] = 1; } else { $config['restore-exclude-previews'] = ''; } - $this->configurationManager->WriteConfig($config); + $this->configurationManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; $id = self::TOP_CONTAINER; $forceStopNextcloud = true; diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 1fb03e68..3e003e61 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public string $selectedRestoreTime { + get => $this->get('selected-restore-time', ''); + set { $this->set('selected-restore-time', $value); } + } + public string $AIO_URL { get => $this->get('AIO_URL', ''); set { $this->set('AIO_URL', $value); } @@ -467,15 +472,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function GetSelectedRestoreTime() : string { - $config = $this->GetConfig(); - if(!isset($config['selected-restore-time'])) { - $config['selected-restore-time'] = ''; - } - - return $config['selected-restore-time']; - } - public function GetRestoreExcludePreviews() : string { $config = $this->GetConfig(); if(!isset($config['restore-exclude-previews'])) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 1c6c418e..8ce0749e 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -565,6 +565,7 @@ readonly class DockerActionManager { 'AIO_URL' => $this->configurationManager->AIO_URL, 'SELECTED_RESTORE_TIME' => $this->configurationManager->GetSelectedRestoreTime(), 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->GetRestoreExcludePreviews(), + 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, 'APACHE_PORT' => $this->configurationManager->GetApachePort(), 'APACHE_IP_BINDING' => $this->configurationManager->GetApacheIPBinding(), 'TALK_PORT' => $this->configurationManager->GetTalkPort(), From c968e9e310ad36d2529e9624abe07d6271b55c27 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:02:19 +0100 Subject: [PATCH 10/92] Make `restoreExcludePreviews` an attribute Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 6 +----- php/src/Data/ConfigurationManager.php | 14 +++++--------- php/src/Docker/DockerActionManager.php | 3 +-- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 1848ccab..0ee4e522 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -124,12 +124,8 @@ readonly class DockerController { public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { $this->configurationManager->SetBackupMode('restore'); - if (isset($request->getParsedBody()['restore-exclude-previews'])) { - $config['restore-exclude-previews'] = 1; - } else { - $config['restore-exclude-previews'] = ''; - } $this->configurationManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; + $this->configurationManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); $id = self::TOP_CONTAINER; $forceStopNextcloud = true; diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 3e003e61..d216fedd 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public bool $restoreExcludePreviews { + get => $this->get('restore-exclude-previews', false); + set { $this->set('restore-exclude-previews', $value); } + } + public string $selectedRestoreTime { get => $this->get('selected-restore-time', ''); set { $this->set('selected-restore-time', $value); } @@ -472,15 +477,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function GetRestoreExcludePreviews() : string { - $config = $this->GetConfig(); - if(!isset($config['restore-exclude-previews'])) { - $config['restore-exclude-previews'] = ''; - } - - return $config['restore-exclude-previews']; - } - /** * @throws InvalidSettingConfigurationException */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 8ce0749e..b04124f3 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -563,8 +563,7 @@ readonly class DockerActionManager { 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(), 'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(), 'AIO_URL' => $this->configurationManager->AIO_URL, - 'SELECTED_RESTORE_TIME' => $this->configurationManager->GetSelectedRestoreTime(), - 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->GetRestoreExcludePreviews(), + 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->restoreExcludePreviews ? '1' : '', 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, 'APACHE_PORT' => $this->configurationManager->GetApachePort(), 'APACHE_IP_BINDING' => $this->configurationManager->GetApacheIPBinding(), From 881e77cca5d4b975f8ae2588dde4cd5a02898043 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:00:22 +0100 Subject: [PATCH 11/92] Make `isWhiteboardEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +----- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 59708627..a0b45675 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -136,7 +136,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(), 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled(), - 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled(), + 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, 'community_containers' => $configurationManager->listAvailableCommunityContainers(), 'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(), 'bypass_container_update' => $bypass_container_update, diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index d7498047..ccca996f 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -91,7 +91,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-whiteboard') { - if (!$this->configurationManager->isWhiteboardEnabled()) { + if (!$this->configurationManager->isWhiteboardEnabled) { continue; } } @@ -200,7 +200,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-whiteboard') { - if (!$this->configurationManager->isWhiteboardEnabled()) { + if (!$this->configurationManager->isWhiteboardEnabled) { continue; } } diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index b449db6a..62034681 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -119,11 +119,7 @@ readonly class ConfigurationController { } else { $this->configurationManager->SetDockerSocketProxyEnabledState(0); } - if (isset($request->getParsedBody()['whiteboard'])) { - $this->configurationManager->SetWhiteboardEnabledState(1); - } else { - $this->configurationManager->SetWhiteboardEnabledState(0); - } + $this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']); } if (isset($request->getParsedBody()['community-form'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d216fedd..a6dd196a 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public bool $isWhiteboardEnabled { + get => $this->get('isWhiteboardEnabled', true); + set { $this->set('isWhiteboardEnabled', $value); } + } + public bool $restoreExcludePreviews { get => $this->get('restore-exclude-previews', false); set { $this->set('restore-exclude-previews', $value); } @@ -207,21 +212,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function isWhiteboardEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isWhiteboardEnabled']) && $config['isWhiteboardEnabled'] === 0) { - return false; - } else { - return true; - } - } - - public function SetWhiteboardEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isWhiteboardEnabled'] = $value; - $this->WriteConfig($config); - } - public function SetClamavEnabledState(int $value) : void { $config = $this->GetConfig(); $config['isClamavEnabled'] = $value; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index b04124f3..72abd49c 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -601,7 +601,7 @@ readonly class DockerActionManager { 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), // Allow to get local ip-address of caddy container and add it to trusted proxies automatically 'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->GetEnabledCommunityContainers(), true) ? gethostbyname('nextcloud-aio-caddy') : '', - 'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled() ? 'yes' : '', + 'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled ? 'yes' : '', default => $this->configurationManager->GetRegisteredSecret($placeholder), }; } From 6576d3c1e9e8e4d0c118dc3388ab8415152b7690 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:58:50 +0100 Subject: [PATCH 12/92] Make `backupMode` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/DockerController.php | 14 +++++++------- php/src/Data/ConfigurationManager.php | 20 +++++--------------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index a0b45675..6abe1989 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -104,7 +104,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_backup_container_running' => $dockerActionManager->isBackupContainerRunning(), 'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(), 'is_instance_restore_attempt' => $configurationManager->isInstanceRestoreAttempt(), - 'borg_backup_mode' => $configurationManager->GetBackupMode(), + 'borg_backup_mode' => $configurationManager->backupMode, 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked, 'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(), 'last_backup_time' => $configurationManager->GetLastBackupTime(), diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 0ee4e522..566f430a 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -89,7 +89,7 @@ readonly class DockerController { } public function startBackup(bool $forceStopNextcloud = false) : void { - $this->configurationManager->SetBackupMode('backup'); + $this->configurationManager->backupMode = 'backup'; $id = self::TOP_CONTAINER; $this->PerformRecursiveContainerStop($id, $forceStopNextcloud); @@ -109,21 +109,21 @@ readonly class DockerController { } public function checkBackup() : void { - $this->configurationManager->SetBackupMode('check'); + $this->configurationManager->backupMode = 'check'; $id = 'nextcloud-aio-borgbackup'; $this->PerformRecursiveContainerStart($id); } private function listBackup() : void { - $this->configurationManager->SetBackupMode('list'); + $this->configurationManager->backupMode = 'list'; $id = 'nextcloud-aio-borgbackup'; $this->PerformRecursiveContainerStart($id); } public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { - $this->configurationManager->SetBackupMode('restore'); + $this->configurationManager->backupMode = 'restore'; $this->configurationManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; $this->configurationManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); @@ -138,22 +138,22 @@ readonly class DockerController { } public function StartBackupContainerCheckRepair(Request $request, Response $response, array $args) : Response { - $this->configurationManager->SetBackupMode('check-repair'); + $this->configurationManager->backupMode = 'check-repair'; $id = 'nextcloud-aio-borgbackup'; $this->PerformRecursiveContainerStart($id); // Restore to backup check which is needed to make the UI logic work correctly - $this->configurationManager->SetBackupMode('check'); + $this->configurationManager->backupMode = 'check'; return $response->withStatus(201)->withHeader('Location', '.'); } public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { - $this->configurationManager->SetBackupMode('test'); $config = $this->configurationManager->GetConfig(); $config['instance_restore_attempt'] = 0; $this->configurationManager->WriteConfig($config); + $this->configurationManager->backupMode = 'test'; $id = self::TOP_CONTAINER; $this->PerformRecursiveContainerStop($id); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index a6dd196a..e21984b6 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -38,6 +38,11 @@ class ConfigurationManager set { $this->set('selected-restore-time', $value); } } + public string $backupMode { + get => $this->get('backup-mode', ''); + set { $this->set('backup-mode', $value); } + } + public string $AIO_URL { get => $this->get('AIO_URL', ''); set { $this->set('AIO_URL', $value); } @@ -452,21 +457,6 @@ class ConfigurationManager return 'dc=' . implode(',dc=', explode('.', $domain)); } - public function GetBackupMode() : string { - $config = $this->GetConfig(); - if(!isset($config['backup-mode'])) { - $config['backup-mode'] = ''; - } - - return $config['backup-mode']; - } - - public function SetBackupMode(string $mode) : void { - $config = $this->GetConfig(); - $config['backup-mode'] = $mode; - $this->WriteConfig($config); - } - /** * @throws InvalidSettingConfigurationException */ From f235af29e33f7d84197a3861754fe3e5792a21bf Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:56:10 +0100 Subject: [PATCH 13/92] Make `isDockerSocketProxyEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +----- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 6abe1989..caff178c 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -135,7 +135,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(), - 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled(), + 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, 'community_containers' => $configurationManager->listAvailableCommunityContainers(), 'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index ccca996f..fe454fba 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -87,7 +87,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-docker-socket-proxy') { - if (!$this->configurationManager->isDockerSocketProxyEnabled()) { + if (!$this->configurationManager->isDockerSocketProxyEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-whiteboard') { @@ -196,7 +196,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-docker-socket-proxy') { - if (!$this->configurationManager->isDockerSocketProxyEnabled()) { + if (!$this->configurationManager->isDockerSocketProxyEnabled) { continue; } } elseif ($value === 'nextcloud-aio-whiteboard') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 62034681..76eefae5 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -114,11 +114,7 @@ readonly class ConfigurationController { } else { $this->configurationManager->SetFulltextsearchEnabledState(0); } - if (isset($request->getParsedBody()['docker-socket-proxy'])) { - $this->configurationManager->SetDockerSocketProxyEnabledState(1); - } else { - $this->configurationManager->SetDockerSocketProxyEnabledState(0); - } + $this->configurationManager->isDockerSocketProxyEnabled = isset($request->getParsedBody()['docker-socket-proxy']); $this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']); } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e21984b6..a44751c4 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -23,6 +23,11 @@ class ConfigurationManager set { $this->set('password', $value); } } + public bool $isDockerSocketProxyEnabled { + get => $this->get('isDockerSocketProxyEnabled', false); + set { $this->set('isDockerSocketProxyEnabled', $value); } + } + public bool $isWhiteboardEnabled { get => $this->get('isWhiteboardEnabled', true); set { $this->set('isWhiteboardEnabled', $value); } @@ -202,21 +207,6 @@ class ConfigurationManager } } - public function isDockerSocketProxyEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isDockerSocketProxyEnabled']) && $config['isDockerSocketProxyEnabled'] === 1) { - return true; - } else { - return false; - } - } - - public function SetDockerSocketProxyEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isDockerSocketProxyEnabled'] = $value; - $this->WriteConfig($config); - } - public function SetClamavEnabledState(int $value) : void { $config = $this->GetConfig(); $config['isClamavEnabled'] = $value; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 72abd49c..66368ca4 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -581,7 +581,7 @@ readonly class DockerActionManager { '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' : '', '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_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(), 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->GetNextcloudMaxTime(), From bebae7069b41d4c49bc13fa6817ee1241cb4751c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:52:03 +0100 Subject: [PATCH 14/92] Make `instance_restore_attempt` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/DockerController.php | 4 +--- php/src/Data/ConfigurationManager.php | 22 +++++++++------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index caff178c..235a3ffc 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -103,7 +103,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'has_backup_run_once' => $configurationManager->hasBackupRunOnce(), 'is_backup_container_running' => $dockerActionManager->isBackupContainerRunning(), 'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(), - 'is_instance_restore_attempt' => $configurationManager->isInstanceRestoreAttempt(), + 'is_instance_restore_attempt' => $configurationManager->instance_restore_attempt, 'borg_backup_mode' => $configurationManager->backupMode, 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked, 'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(), diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 566f430a..df6fbe5d 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -150,10 +150,8 @@ readonly class DockerController { } public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { - $config = $this->configurationManager->GetConfig(); - $config['instance_restore_attempt'] = 0; - $this->configurationManager->WriteConfig($config); $this->configurationManager->backupMode = 'test'; + $this->configurationManager->instance_restore_attempt = false; $id = self::TOP_CONTAINER; $this->PerformRecursiveContainerStop($id); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index a44751c4..12d4aef2 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -48,6 +48,11 @@ class ConfigurationManager set { $this->set('backup-mode', $value); } } + public bool $instance_restore_attempt { + get => $this->get('instance_restore_attempt', false); + set { $this->set('instance_restore_attempt', $value); } + } + public string $AIO_URL { get => $this->get('AIO_URL', ''); set { $this->set('AIO_URL', $value); } @@ -529,8 +534,11 @@ class ConfigurationManager $config['borg_backup_host_location'] = $location; $config['borg_remote_repo'] = $repo; $config['borg_restore_password'] = $password; - $config['instance_restore_attempt'] = 1; $this->WriteConfig($config); + + $this->setMultiple(function ($confManager) { + $confManager->instance_restore_attempt = true; + }); } /** @@ -663,18 +671,6 @@ class ConfigurationManager return $config['borg_restore_password']; } - public function isInstanceRestoreAttempt() : bool { - $config = $this->GetConfig(); - if(!isset($config['instance_restore_attempt'])) { - $config['instance_restore_attempt'] = ''; - } - - if ($config['instance_restore_attempt'] === 1) { - return true; - } - return false; - } - public function GetNextcloudMount() : string { $envVariableName = 'NEXTCLOUD_MOUNT'; $configName = 'nextcloud_mount'; From f8a244bee2e87c6a0bd46d61ee93b39fb4267b24 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:01:53 +0100 Subject: [PATCH 15/92] Make `isClamavEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +----- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 235a3ffc..c213251d 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -110,7 +110,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'last_backup_time' => $configurationManager->GetLastBackupTime(), 'backup_times' => $configurationManager->GetBackupTimes(), 'current_channel' => $dockerActionManager->GetCurrentChannel(), - 'is_clamav_enabled' => $configurationManager->isClamavEnabled(), + 'is_clamav_enabled' => $configurationManager->isClamavEnabled, 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled(), 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(), 'is_talk_enabled' => $configurationManager->isTalkEnabled(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index fe454fba..639f6513 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -56,7 +56,7 @@ readonly class ContainerDefinitionFetcher { $containers = []; foreach ($data['aio_services_v1'] as $entry) { if ($entry['container_name'] === 'nextcloud-aio-clamav') { - if (!$this->configurationManager->isClamavEnabled()) { + if (!$this->configurationManager->isClamavEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-onlyoffice') { @@ -168,7 +168,7 @@ readonly class ContainerDefinitionFetcher { } foreach ($valueDependsOn as $value) { if ($value === 'nextcloud-aio-clamav') { - if (!$this->configurationManager->isClamavEnabled()) { + if (!$this->configurationManager->isClamavEnabled) { continue; } } elseif ($value === 'nextcloud-aio-onlyoffice') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 76eefae5..b8a4bb6c 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -88,11 +88,7 @@ readonly class ConfigurationController { $this->configurationManager->SetCollaboraEnabledState(0); $this->configurationManager->SetOnlyofficeEnabledState(0); } - - if (isset($request->getParsedBody()['clamav'])) { - $this->configurationManager->SetClamavEnabledState(1); - } else { - $this->configurationManager->SetClamavEnabledState(0); + $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); } if (isset($request->getParsedBody()['talk'])) { $this->configurationManager->SetTalkEnabledState(1); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 12d4aef2..485ca6ce 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -68,6 +68,11 @@ class ConfigurationManager set { $this->set('install_latest_major', $value); } } + public bool $isClamavEnabled { + get => $this->get('isClamavEnabled', false); + set { $this->set('isClamavEnabled', $value); } + } + public function GetConfig() : array { 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 { $config = $this->GetConfig(); if (isset($config['isImaginaryEnabled']) && $config['isImaginaryEnabled'] === 0) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 66368ca4..86401005 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -571,7 +571,7 @@ readonly class DockerActionManager { 'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(), 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), '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' : '', 'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled() ? 'yes' : '', 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled() ? 'yes' : '', From 0c3d919618f5e61173a7c7b3533926fdd5bd4434 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:02:41 +0100 Subject: [PATCH 16/92] Make `isOnlyofficeEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 7 +++---- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index c213251d..75607e63 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -111,7 +111,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'backup_times' => $configurationManager->GetBackupTimes(), 'current_channel' => $dockerActionManager->GetCurrentChannel(), 'is_clamav_enabled' => $configurationManager->isClamavEnabled, - 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled(), + 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled, 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(), 'is_talk_enabled' => $configurationManager->isTalkEnabled(), 'borg_restore_password' => $configurationManager->GetBorgRestorePassword(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 639f6513..d101178b 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -60,7 +60,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-onlyoffice') { - if (!$this->configurationManager->isOnlyofficeEnabled()) { + if (!$this->configurationManager->isOnlyofficeEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-collabora') { @@ -172,7 +172,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-onlyoffice') { - if (!$this->configurationManager->isOnlyofficeEnabled()) { + if (!$this->configurationManager->isOnlyofficeEnabled) { continue; } } elseif ($value === 'nextcloud-aio-collabora') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index b8a4bb6c..d39efd2a 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -80,16 +80,15 @@ readonly class ConfigurationController { if ($officeSuiteChoice === 'collabora') { $this->configurationManager->SetCollaboraEnabledState(1); - $this->configurationManager->SetOnlyofficeEnabledState(0); + $this->configurationManager->isOnlyofficeEnabled = false; } elseif ($officeSuiteChoice === 'onlyoffice') { $this->configurationManager->SetCollaboraEnabledState(0); - $this->configurationManager->SetOnlyofficeEnabledState(1); + $this->configurationManager->isOnlyofficeEnabled = true; } else { $this->configurationManager->SetCollaboraEnabledState(0); - $this->configurationManager->SetOnlyofficeEnabledState(0); + $this->configurationManager->isOnlyofficeEnabled = false; } $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); - } if (isset($request->getParsedBody()['talk'])) { $this->configurationManager->SetTalkEnabledState(1); } else { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 485ca6ce..36cea5e0 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -73,6 +73,11 @@ class ConfigurationManager set { $this->set('isClamavEnabled', $value); } } + public bool $isOnlyofficeEnabled { + get => $this->get('isOnlyofficeEnabled', false); + set { $this->set('isOnlyofficeEnabled', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -243,21 +248,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function isOnlyofficeEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isOnlyofficeEnabled']) && $config['isOnlyofficeEnabled'] === 1) { - return true; - } else { - return false; - } - } - - public function SetOnlyofficeEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isOnlyofficeEnabled'] = $value; - $this->WriteConfig($config); - } - public function isCollaboraEnabled() : bool { $config = $this->GetConfig(); if (isset($config['isCollaboraEnabled']) && $config['isCollaboraEnabled'] === 0) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 86401005..16771c6c 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -573,7 +573,7 @@ readonly class DockerActionManager { 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(), 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? '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' : '', 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled() ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', From cd1c2276e5ca2959ced114d881caf5dfa5bbc8d5 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:03:12 +0100 Subject: [PATCH 17/92] Make `isCollaboraEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +++--- php/src/Controller/DockerController.php | 2 +- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 6 files changed, 13 insertions(+), 23 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 75607e63..adfd72d5 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -112,7 +112,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'current_channel' => $dockerActionManager->GetCurrentChannel(), 'is_clamav_enabled' => $configurationManager->isClamavEnabled, 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled, - 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(), + 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled, 'is_talk_enabled' => $configurationManager->isTalkEnabled(), 'borg_restore_password' => $configurationManager->GetBorgRestorePassword(), 'daily_backup_time' => $configurationManager->GetDailyBackupTime(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index d101178b..e4e27f69 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -64,7 +64,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-collabora') { - if (!$this->configurationManager->isCollaboraEnabled()) { + if (!$this->configurationManager->isCollaboraEnabled) { continue; } if ($this->configurationManager->isCollaboraSubscriptionEnabled()) { @@ -176,7 +176,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-collabora') { - if (!$this->configurationManager->isCollaboraEnabled()) { + if (!$this->configurationManager->isCollaboraEnabled) { continue; } } elseif ($value === 'nextcloud-aio-talk') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index d39efd2a..56621eee 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -79,13 +79,13 @@ readonly class ConfigurationController { $officeSuiteChoice = $request->getParsedBody()['office_suite_choice'] ?? ''; if ($officeSuiteChoice === 'collabora') { - $this->configurationManager->SetCollaboraEnabledState(1); + $this->configurationManager->isCollaboraEnabled = true; $this->configurationManager->isOnlyofficeEnabled = false; } elseif ($officeSuiteChoice === 'onlyoffice') { - $this->configurationManager->SetCollaboraEnabledState(0); + $this->configurationManager->isCollaboraEnabled = false; $this->configurationManager->isOnlyofficeEnabled = true; } else { - $this->configurationManager->SetCollaboraEnabledState(0); + $this->configurationManager->isCollaboraEnabled = false; $this->configurationManager->isOnlyofficeEnabled = false; } $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index df6fbe5d..ff73e29a 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -224,7 +224,7 @@ readonly class DockerController { // This is a hack but no better solution was found for the meantime // Stop Collabora first to make sure it force-saves // See https://github.com/nextcloud/richdocuments/issues/3799 - if ($id === self::TOP_CONTAINER && $this->configurationManager->isCollaboraEnabled()) { + if ($id === self::TOP_CONTAINER && $this->configurationManager->isCollaboraEnabled) { $this->PerformRecursiveContainerStop('nextcloud-aio-collabora'); } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 36cea5e0..165f9c44 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -78,6 +78,11 @@ class ConfigurationManager set { $this->set('isOnlyofficeEnabled', $value); } } + public bool $isCollaboraEnabled { + get => $this->get('isCollaboraEnabled', true); + set { $this->set('isCollaboraEnabled', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -248,21 +253,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function isCollaboraEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isCollaboraEnabled']) && $config['isCollaboraEnabled'] === 0) { - return false; - } else { - return true; - } - } - - public function SetCollaboraEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isCollaboraEnabled'] = $value; - $this->WriteConfig($config); - } - public function isTalkEnabled() : bool { $config = $this->GetConfig(); if (isset($config['isTalkEnabled']) && $config['isTalkEnabled'] === 0) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 16771c6c..7cb20ad6 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -574,7 +574,7 @@ readonly class DockerActionManager { 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '', 'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled() ? 'yes' : '', 'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '', - 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled() ? 'yes' : '', + 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled ? 'yes' : '', 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled() ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', 'TIMEZONE' => $this->configurationManager->GetTimezone() === '' ? 'Etc/UTC' : $this->configurationManager->GetTimezone(), From e009abdd54030b654044f567fb88873b6365dc42 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:03:38 +0100 Subject: [PATCH 18/92] Make `isTalkEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +----- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index adfd72d5..0481aceb 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -113,7 +113,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_clamav_enabled' => $configurationManager->isClamavEnabled, 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled, 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled, - 'is_talk_enabled' => $configurationManager->isTalkEnabled(), + 'is_talk_enabled' => $configurationManager->isTalkEnabled, 'borg_restore_password' => $configurationManager->GetBorgRestorePassword(), 'daily_backup_time' => $configurationManager->GetDailyBackupTime(), 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index e4e27f69..9635c8cf 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -71,7 +71,7 @@ readonly class ContainerDefinitionFetcher { $entry['image'] = 'ghcr.io/nextcloud-releases/aio-collabora-online'; } } elseif ($entry['container_name'] === 'nextcloud-aio-talk') { - if (!$this->configurationManager->isTalkEnabled()) { + if (!$this->configurationManager->isTalkEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-talk-recording') { @@ -180,7 +180,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-talk') { - if (!$this->configurationManager->isTalkEnabled()) { + if (!$this->configurationManager->isTalkEnabled) { continue; } } elseif ($value === 'nextcloud-aio-talk-recording') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 56621eee..75ec29ae 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -89,11 +89,7 @@ readonly class ConfigurationController { $this->configurationManager->isOnlyofficeEnabled = false; } $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); - if (isset($request->getParsedBody()['talk'])) { - $this->configurationManager->SetTalkEnabledState(1); - } else { - $this->configurationManager->SetTalkEnabledState(0); - } + $this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']); if (isset($request->getParsedBody()['talk-recording'])) { $this->configurationManager->SetTalkRecordingEnabledState(1); } else { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 165f9c44..648d04c3 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -83,6 +83,11 @@ class ConfigurationManager set { $this->set('isCollaboraEnabled', $value); } } + public bool $isTalkEnabled { + get => $this->get('isTalkEnabled', true); + set { $this->set('isTalkEnabled', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -253,21 +258,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function isTalkEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isTalkEnabled']) && $config['isTalkEnabled'] === 0) { - return false; - } else { - return true; - } - } - - public function SetTalkEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isTalkEnabled'] = $value; - $this->WriteConfig($config); - } - public function isTalkRecordingEnabled() : bool { if (!$this->isTalkEnabled()) { return false; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 7cb20ad6..313de7b0 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -575,7 +575,7 @@ readonly class DockerActionManager { 'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled() ? 'yes' : '', 'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '', 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled ? 'yes' : '', - 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled() ? 'yes' : '', + 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', '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(), From 190d47810b8501f0788e5e65dc576ae0284f9554 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:04:04 +0100 Subject: [PATCH 19/92] Make `isTalkRecordingEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 +-- .../Controller/ConfigurationController.php | 6 +---- php/src/Data/ConfigurationManager.php | 27 ++++--------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 31 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 0481aceb..34d7efe1 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -134,7 +134,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(), 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), - 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(), + 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled, 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, 'community_containers' => $configurationManager->listAvailableCommunityContainers(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 9635c8cf..851b2b4d 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -75,7 +75,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-talk-recording') { - if (!$this->configurationManager->isTalkRecordingEnabled()) { + if (!$this->configurationManager->isTalkRecordingEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-imaginary') { @@ -184,7 +184,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-talk-recording') { - if (!$this->configurationManager->isTalkRecordingEnabled()) { + if (!$this->configurationManager->isTalkRecordingEnabled) { continue; } } elseif ($value === 'nextcloud-aio-imaginary') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 75ec29ae..cf8bf02b 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -90,11 +90,7 @@ readonly class ConfigurationController { } $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); $this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']); - if (isset($request->getParsedBody()['talk-recording'])) { - $this->configurationManager->SetTalkRecordingEnabledState(1); - } else { - $this->configurationManager->SetTalkRecordingEnabledState(0); - } + $this->configurationManager->isTalkRecordingEnabled = isset($request->getParsedBody()['talk-recording']); if (isset($request->getParsedBody()['imaginary'])) { $this->configurationManager->SetImaginaryEnabledState(1); } else { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 648d04c3..bd920a04 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -88,6 +88,11 @@ class ConfigurationManager set { $this->set('isTalkEnabled', $value); } } + public bool $isTalkRecordingEnabled { + get => $this->isTalkEnabled && $this->get('isTalkRecordingEnabled', false); + set { $this->set('isTalkRecordingEnabled', $this->isTalkEnabled && $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -258,28 +263,6 @@ class ConfigurationManager $this->WriteConfig($config); } - public function isTalkRecordingEnabled() : bool { - if (!$this->isTalkEnabled()) { - return false; - } - $config = $this->GetConfig(); - if (isset($config['isTalkRecordingEnabled']) && $config['isTalkRecordingEnabled'] === 1) { - return true; - } else { - return false; - } - } - - public function SetTalkRecordingEnabledState(int $value) : void { - if (!$this->isTalkEnabled()) { - $value = 0; - } - - $config = $this->GetConfig(); - $config['isTalkRecordingEnabled'] = $value; - $this->WriteConfig($config); - } - /** * @throws InvalidSettingConfigurationException */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 313de7b0..ebd1489d 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -572,7 +572,7 @@ readonly class DockerActionManager { 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(), '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' : '', 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled ? 'yes' : '', 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled ? 'yes' : '', From f16f5b233d72ab22e96bb40a65540a2e6ea7efba Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:04:24 +0100 Subject: [PATCH 20/92] Make `isImaginaryEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- .../Controller/ConfigurationController.php | 6 +----- php/src/Data/ConfigurationManager.php | 20 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 34d7efe1..27b2edad 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -124,7 +124,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'collabora_additional_options' => $configurationManager->GetAdditionalCollaboraOptions(), 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), - 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled(), + 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled(), 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 851b2b4d..75d47f83 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -79,7 +79,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-imaginary') { - if (!$this->configurationManager->isImaginaryEnabled()) { + if (!$this->configurationManager->isImaginaryEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-fulltextsearch') { @@ -188,7 +188,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-imaginary') { - if (!$this->configurationManager->isImaginaryEnabled()) { + if (!$this->configurationManager->isImaginaryEnabled) { continue; } } elseif ($value === 'nextcloud-aio-fulltextsearch') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index cf8bf02b..c7df757b 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -91,11 +91,7 @@ readonly class ConfigurationController { $this->configurationManager->isClamavEnabled = isset($request->getParsedBody()['clamav']); $this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']); $this->configurationManager->isTalkRecordingEnabled = isset($request->getParsedBody()['talk-recording']); - if (isset($request->getParsedBody()['imaginary'])) { - $this->configurationManager->SetImaginaryEnabledState(1); - } else { - $this->configurationManager->SetImaginaryEnabledState(0); - } + $this->configurationManager->isImaginaryEnabled = isset($request->getParsedBody()['imaginary']); if (isset($request->getParsedBody()['fulltextsearch'])) { $this->configurationManager->SetFulltextsearchEnabledState(1); } else { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index bd920a04..65e83524 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -93,6 +93,11 @@ class ConfigurationManager set { $this->set('isTalkRecordingEnabled', $this->isTalkEnabled && $value); } } + public bool $isImaginaryEnabled { + get => $this->get('isImaginaryEnabled', true); + set { $this->set('isImaginaryEnabled', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -228,21 +233,6 @@ class ConfigurationManager } } - public function isImaginaryEnabled() : bool { - $config = $this->GetConfig(); - if (isset($config['isImaginaryEnabled']) && $config['isImaginaryEnabled'] === 0) { - return false; - } else { - return true; - } - } - - public function SetImaginaryEnabledState(int $value) : void { - $config = $this->GetConfig(); - $config['isImaginaryEnabled'] = $value; - $this->WriteConfig($config); - } - public function isFulltextsearchEnabled() : bool { $config = $this->GetConfig(); if (isset($config['isFulltextsearchEnabled']) && $config['isFulltextsearchEnabled'] === 1) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index ebd1489d..a9f2c29e 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -579,7 +579,7 @@ readonly class DockerActionManager { 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', '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(), - 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled() ? 'yes' : '', + 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled() ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->GetNextcloudUploadLimit(), From f737d2f598032df2fd2df3ad9c4f7b4319e91d66 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:04:48 +0100 Subject: [PATCH 21/92] Make `isFulltextsearchEnabled` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 +-- .../Controller/ConfigurationController.php | 6 +---- php/src/Data/ConfigurationManager.php | 26 +++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 11 insertions(+), 29 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 27b2edad..2b1d6af1 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -125,7 +125,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, - 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled(), + 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), 'nextcloud_mount' => $configurationManager->GetNextcloudMount(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 75d47f83..4ac53258 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -83,7 +83,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-fulltextsearch') { - if (!$this->configurationManager->isFulltextsearchEnabled()) { + if (!$this->configurationManager->isFulltextsearchEnabled) { continue; } } elseif ($entry['container_name'] === 'nextcloud-aio-docker-socket-proxy') { @@ -192,7 +192,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value === 'nextcloud-aio-fulltextsearch') { - if (!$this->configurationManager->isFulltextsearchEnabled()) { + if (!$this->configurationManager->isFulltextsearchEnabled) { continue; } } elseif ($value === 'nextcloud-aio-docker-socket-proxy') { diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index c7df757b..9688c5e9 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -92,11 +92,7 @@ readonly class ConfigurationController { $this->configurationManager->isTalkEnabled = isset($request->getParsedBody()['talk']); $this->configurationManager->isTalkRecordingEnabled = isset($request->getParsedBody()['talk-recording']); $this->configurationManager->isImaginaryEnabled = isset($request->getParsedBody()['imaginary']); - if (isset($request->getParsedBody()['fulltextsearch'])) { - $this->configurationManager->SetFulltextsearchEnabledState(1); - } else { - $this->configurationManager->SetFulltextsearchEnabledState(0); - } + $this->configurationManager->isFulltextsearchEnabled = isset($request->getParsedBody()['fulltextsearch']); $this->configurationManager->isDockerSocketProxyEnabled = isset($request->getParsedBody()['docker-socket-proxy']); $this->configurationManager->isWhiteboardEnabled = isset($request->getParsedBody()['whiteboard']); } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 65e83524..43680ca9 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -98,6 +98,12 @@ class ConfigurationManager 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 { 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 */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index a9f2c29e..73f4bd9d 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -580,7 +580,7 @@ readonly class DockerActionManager { '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(), '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' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->GetNextcloudUploadLimit(), 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(), From 5b0b9ef8263e740fa854be09dc424d53ae1ad9ff Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:06:20 +0100 Subject: [PATCH 22/92] Make `domain` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/DockerController.php | 2 +- php/src/Data/ConfigurationManager.php | 25 +++++++++++++------------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 2b1d6af1..f3e8f940 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -91,7 +91,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ $skip_domain_validation = isset($params['skip_domain_validation']); return $view->render($response, 'containers.twig', [ - 'domain' => $configurationManager->GetDomain(), + 'domain' => $configurationManager->domain, 'apache_port' => $configurationManager->GetApachePort(), 'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(), 'borg_remote_repo' => $configurationManager->GetBorgRemoteRepo(), diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index ff73e29a..4e6d52b7 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -257,7 +257,7 @@ readonly class DockerController { public function StartDomaincheckContainer() : void { # Don't start if domain is already set - if ($this->configurationManager->GetDomain() !== '' || $this->configurationManager->wasStartButtonClicked) { + if ($this->configurationManager->domain !== '' || $this->configurationManager->wasStartButtonClicked) { return; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 43680ca9..d276ebb7 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -104,6 +104,11 @@ class ConfigurationManager set { $this->set('isFulltextsearchEnabled', ($this->isSeccompDisabled() && $value)); } } + public string $domain { + get => $this->get('domain', ''); + set { $this->SetDomain($value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -241,6 +246,8 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException + * + * We can't turn this into a private validation method because of the second argument. */ public function SetDomain(string $domain, bool $skipDomainValidation) : void { // Validate that at least one dot is contained @@ -346,25 +353,19 @@ class ConfigurationManager } } - // Write domain $config = $this->GetConfig(); - $config['domain'] = $domain; // Reset the borg restore password when setting the domain $config['borg_restore_password'] = ''; $this->WriteConfig($config); - } - - public function GetDomain() : string { - $config = $this->GetConfig(); - if(!isset($config['domain'])) { - $config['domain'] = ''; - } - - return $config['domain']; + $this->setMultiple(function ($confManager) use ($domain) { + // Write domain + // Don't set the domain via the attribute, or we create a loop. + $confManager->set('domain', $domain); + }); } public function GetBaseDN() : string { - $domain = $this->GetDomain(); + $domain = $this->domain; if ($domain === "") { return ""; } From b4d198f72b14cc52e667bf782d3db51c4fd80c34 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:07:45 +0100 Subject: [PATCH 23/92] Make `borg_backup_host_location` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 26 +++++++++++++------------- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index f3e8f940..eb214eff 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -93,7 +93,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ return $view->render($response, 'containers.twig', [ 'domain' => $configurationManager->domain, 'apache_port' => $configurationManager->GetApachePort(), - 'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(), + 'borg_backup_host_location' => $configurationManager->borg_backup_host_location, 'borg_remote_repo' => $configurationManager->GetBorgRemoteRepo(), 'borg_public_key' => $configurationManager->GetBorgPublicKey(), 'nextcloud_password' => $configurationManager->GetAndGenerateSecret('NEXTCLOUD_PASSWORD'), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 4ac53258..e8244ddc 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -113,7 +113,7 @@ readonly class ContainerDefinitionFetcher { if (isset($entry['volumes'])) { foreach ($entry['volumes'] as $value) { if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') { - $value['source'] = $this->configurationManager->GetBorgBackupHostLocation(); + $value['source'] = $this->configurationManager->borg_backup_host_location; if($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d276ebb7..1c93f51b 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -109,6 +109,11 @@ class ConfigurationManager set { $this->SetDomain($value); } } + public string $borg_backup_host_location { + get => $this->get('borg_backup_host_location', ''); + set { $this->set('borg_backup_host_location', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -379,9 +384,11 @@ class ConfigurationManager $this->ValidateBorgLocationVars($location, $repo); $config = $this->GetConfig(); - $config['borg_backup_host_location'] = $location; $config['borg_remote_repo'] = $repo; $this->WriteConfig($config); + $this->setMultiple(function ($confManager) use ($location) { + $confManager->borg_backup_host_location = $location; + }); } private function ValidateBorgLocationVars(string $location, string $repo) : void { @@ -428,9 +435,11 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables $config = $this->GetConfig(); - $config['borg_backup_host_location'] = ''; $config['borg_remote_repo'] = ''; $this->WriteConfig($config); + $this->setMultiple(function ($confManager) { + $confManager->borg_backup_host_location = ''; + }); // Also delete the borg config file to be able to start over if (file_exists(DataConst::GetBackupKeyFile())) { @@ -451,12 +460,12 @@ class ConfigurationManager } $config = $this->GetConfig(); - $config['borg_backup_host_location'] = $location; $config['borg_remote_repo'] = $repo; $config['borg_restore_password'] = $password; $this->WriteConfig($config); - $this->setMultiple(function ($confManager) { + $this->setMultiple(function ($confManager) use ($location) { + $confManager->borg_backup_host_location = $location; $confManager->instance_restore_attempt = true; }); } @@ -556,15 +565,6 @@ class ConfigurationManager return $envVariableOutput; } - public function GetBorgBackupHostLocation() : string { - $config = $this->GetConfig(); - if(!isset($config['borg_backup_host_location'])) { - $config['borg_backup_host_location'] = ''; - } - - return $config['borg_backup_host_location']; - } - public function GetBorgRemoteRepo() : string { $config = $this->GetConfig(); if(!isset($config['borg_remote_repo'])) { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 73f4bd9d..a3ea0c9b 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -589,7 +589,7 @@ readonly class DockerActionManager { 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->configurationManager->GetFulltextsearchJavaOptions(), 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->configurationManager->GetTrustedCacertsDir(), 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->configurationManager->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', - 'BORGBACKUP_HOST_LOCATION' => $this->configurationManager->GetBorgBackupHostLocation(), + 'BORGBACKUP_HOST_LOCATION' => $this->configurationManager->borg_backup_host_location, 'APACHE_MAX_SIZE' => (string)($this->configurationManager->GetApacheMaxSize()), 'COLLABORA_SECCOMP_POLICY' => $this->configurationManager->GetCollaboraSeccompPolicy(), 'NEXTCLOUD_STARTUP_APPS' => $this->configurationManager->GetNextcloudStartupApps(), From a361ab9d20f4cfc4c5c0fc071509756a734bdea1 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:14:39 +0100 Subject: [PATCH 24/92] Make `borg_remote_repo` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 24 ++++++++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index eb214eff..16d274f9 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -94,7 +94,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'domain' => $configurationManager->domain, 'apache_port' => $configurationManager->GetApachePort(), 'borg_backup_host_location' => $configurationManager->borg_backup_host_location, - 'borg_remote_repo' => $configurationManager->GetBorgRemoteRepo(), + 'borg_remote_repo' => $configurationManager->borg_remote_repo, 'borg_public_key' => $configurationManager->GetBorgPublicKey(), 'nextcloud_password' => $configurationManager->GetAndGenerateSecret('NEXTCLOUD_PASSWORD'), 'containers' => (new \AIO\ContainerDefinitionFetcher($container->get(\AIO\Data\ConfigurationManager::class), $container))->FetchDefinition(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 1c93f51b..5dea0c6d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -114,6 +114,11 @@ class ConfigurationManager set { $this->set('borg_backup_host_location', $value); } } + public string $borg_remote_repo { + get => $this->get('borg_remote_repo', ''); + set { $this->set('borg_remote_repo', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -384,10 +389,10 @@ class ConfigurationManager $this->ValidateBorgLocationVars($location, $repo); $config = $this->GetConfig(); - $config['borg_remote_repo'] = $repo; $this->WriteConfig($config); - $this->setMultiple(function ($confManager) use ($location) { + $this->setMultiple(function ($confManager) use ($location, $repo) { $confManager->borg_backup_host_location = $location; + $confManager->borg_remote_repo = $repo; }); } @@ -435,10 +440,10 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables $config = $this->GetConfig(); - $config['borg_remote_repo'] = ''; $this->WriteConfig($config); $this->setMultiple(function ($confManager) { $confManager->borg_backup_host_location = ''; + $confManager->borg_remote_repo = ''; }); // Also delete the borg config file to be able to start over @@ -460,12 +465,12 @@ class ConfigurationManager } $config = $this->GetConfig(); - $config['borg_remote_repo'] = $repo; $config['borg_restore_password'] = $password; $this->WriteConfig($config); - $this->setMultiple(function ($confManager) use ($location) { + $this->setMultiple(function ($confManager) use ($location, $repo) { $confManager->borg_backup_host_location = $location; + $confManager->borg_remote_repo = $repo; $confManager->instance_restore_attempt = true; }); } @@ -565,15 +570,6 @@ class ConfigurationManager return $envVariableOutput; } - public function GetBorgRemoteRepo() : string { - $config = $this->GetConfig(); - if(!isset($config['borg_remote_repo'])) { - $config['borg_remote_repo'] = ''; - } - - return $config['borg_remote_repo']; - } - public function GetBorgPublicKey() : string { if (!file_exists(DataConst::GetBackupPublicKey())) { return ""; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index a3ea0c9b..876dd805 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -560,7 +560,7 @@ readonly class DockerActionManager { 'NC_DOMAIN' => $this->configurationManager->GetDomain(), 'NC_BASE_DN' => $this->configurationManager->GetBaseDN(), 'AIO_TOKEN' => $this->configurationManager->AIO_TOKEN, - 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(), + 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->borg_remote_repo, 'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(), 'AIO_URL' => $this->configurationManager->AIO_URL, 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->restoreExcludePreviews ? '1' : '', From 6033a4486c147eab303ba9f8120ab4663e348084 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:16:30 +0100 Subject: [PATCH 25/92] Make `borg_restore_password` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 23 +++++++++-------------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 16d274f9..05c39f76 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -114,7 +114,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled, 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled, 'is_talk_enabled' => $configurationManager->isTalkEnabled, - 'borg_restore_password' => $configurationManager->GetBorgRestorePassword(), + 'borg_restore_password' => $configurationManager->borg_restore_password, 'daily_backup_time' => $configurationManager->GetDailyBackupTime(), 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), 'timezone' => $configurationManager->GetTimezone(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 5dea0c6d..2091ddb5 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -119,6 +119,11 @@ class ConfigurationManager set { $this->set('borg_remote_repo', $value); } } + public string $borg_restore_password { + get => $this->get('borg_restore_password', ''); + set { $this->set('borg_restore_password', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -364,13 +369,13 @@ class ConfigurationManager } $config = $this->GetConfig(); - // Reset the borg restore password when setting the domain - $config['borg_restore_password'] = ''; $this->WriteConfig($config); $this->setMultiple(function ($confManager) use ($domain) { // Write domain // Don't set the domain via the attribute, or we create a loop. $confManager->set('domain', $domain); + // Reset the borg restore password when setting the domain + $confManager->borg_restore_password = ''; }); } @@ -465,12 +470,11 @@ class ConfigurationManager } $config = $this->GetConfig(); - $config['borg_restore_password'] = $password; $this->WriteConfig($config); - - $this->setMultiple(function ($confManager) use ($location, $repo) { + $this->setMultiple(function ($confManager) use ($location, $repo, $password) { $confManager->borg_backup_host_location = $location; $confManager->borg_remote_repo = $repo; + $confManager->borg_restore_password = $password; $confManager->instance_restore_attempt = true; }); } @@ -578,15 +582,6 @@ class ConfigurationManager return trim((string)file_get_contents(DataConst::GetBackupPublicKey())); } - public function GetBorgRestorePassword() : string { - $config = $this->GetConfig(); - if(!isset($config['borg_restore_password'])) { - $config['borg_restore_password'] = ''; - } - - return $config['borg_restore_password']; - } - public function GetNextcloudMount() : string { $envVariableName = 'NEXTCLOUD_MOUNT'; $configName = 'nextcloud_mount'; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 876dd805..8b9720fb 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -570,7 +570,7 @@ readonly class DockerActionManager { 'TALK_PORT' => $this->configurationManager->GetTalkPort(), 'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(), 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), - 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(), + 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password, 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '', 'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled ? 'yes' : '', 'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '', From 6e5237cd205f0dc6ef069b6026f43a77028d00e7 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:17:25 +0100 Subject: [PATCH 26/92] Make `timezone` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- .../Controller/ConfigurationController.php | 4 +-- php/src/Data/ConfigurationManager.php | 36 +++++++++---------- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 05c39f76..130d34d5 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -117,7 +117,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'borg_restore_password' => $configurationManager->borg_restore_password, 'daily_backup_time' => $configurationManager->GetDailyBackupTime(), 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), - 'timezone' => $configurationManager->GetTimezone(), + 'timezone' => $configurationManager->timezone, 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), 'talk_port' => $configurationManager->GetTalkPort(), 'collabora_dictionaries' => $configurationManager->GetCollaboraDictionaries(), diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 9688c5e9..58337ef4 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -67,12 +67,12 @@ readonly class ConfigurationController { } if (isset($request->getParsedBody()['delete_timezone'])) { - $this->configurationManager->DeleteTimezone(); + $this->configurationManager->deleteTimezone(); } if (isset($request->getParsedBody()['timezone'])) { $timezone = $request->getParsedBody()['timezone'] ?? ''; - $this->configurationManager->SetTimezone($timezone); + $this->configurationManager->timezone = $timezone; } if (isset($request->getParsedBody()['options-form'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2091ddb5..119e81ce 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -124,6 +124,18 @@ class ConfigurationManager set { $this->set('borg_restore_password', $value); } } + /** + * @throws InvalidSettingConfigurationException + */ + public string $timezone { + get => $this->get('timezone', ''); + set { + // This throws an exception if the validation fails. + $this->validateTimezone($value); + $this->set('timezone', $value); + } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -784,19 +796,10 @@ class ConfigurationManager return false; } - public function GetTimezone() : string { - $config = $this->GetConfig(); - if(!isset($config['timezone'])) { - $config['timezone'] = ''; - } - - return $config['timezone']; - } - /** * @throws InvalidSettingConfigurationException */ - public function SetTimezone(string $timezone) : void { + private function validateTimezone(string $timezone) : void { if ($timezone === "") { throw new InvalidSettingConfigurationException("The timezone must not be empty!"); } @@ -804,16 +807,13 @@ class ConfigurationManager if (!preg_match("#^[a-zA-Z0-9_\-\/\+]+$#", $timezone)) { throw new InvalidSettingConfigurationException("The entered timezone does not seem to be a valid timezone!"); } - - $config = $this->GetConfig(); - $config['timezone'] = $timezone; - $this->WriteConfig($config); } - public function DeleteTimezone() : void { - $config = $this->GetConfig(); - $config['timezone'] = ''; - $this->WriteConfig($config); + /** + * Provide an extra method since our `timezone` attribute setter prevents setting an empty timezone. + */ + public function deleteTimezone() : void { + $this->set('timezone', ''); } public function shouldDomainValidationBeSkipped(bool $skipDomainValidation) : bool { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 8b9720fb..ae8e9c83 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -577,7 +577,7 @@ readonly class DockerActionManager { 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled ? 'yes' : '', 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', - 'TIMEZONE' => $this->configurationManager->GetTimezone() === '' ? 'Etc/UTC' : $this->configurationManager->GetTimezone(), + 'TIMEZONE' => $this->configurationManager->timezone === '' ? 'Etc/UTC' : $this->configurationManager->timezone, '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' : '', 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '', From ca35006a8595e6abbb0d6313b819ae98b8ea2068 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:18:45 +0100 Subject: [PATCH 27/92] Make `collabora_dictionaries` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- .../Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 34 +++++++++---------- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 130d34d5..dc0151e2 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -120,7 +120,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'timezone' => $configurationManager->timezone, 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), 'talk_port' => $configurationManager->GetTalkPort(), - 'collabora_dictionaries' => $configurationManager->GetCollaboraDictionaries(), + 'collabora_dictionaries' => $configurationManager->collabora_dictionaries, 'collabora_additional_options' => $configurationManager->GetAdditionalCollaboraOptions(), 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 58337ef4..4a36ce5c 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -117,7 +117,7 @@ readonly class ConfigurationController { if (isset($request->getParsedBody()['collabora_dictionaries'])) { $collaboraDictionaries = $request->getParsedBody()['collabora_dictionaries'] ?? ''; - $this->configurationManager->SetCollaboraDictionaries($collaboraDictionaries); + $this->configurationManager->collabora_dictionaries = $collaboraDictionaries; } if (isset($request->getParsedBody()['delete_collabora_additional_options'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 119e81ce..9f037ec4 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -136,6 +136,18 @@ class ConfigurationManager } } + /** + * @throws InvalidSettingConfigurationException + */ + public string $collabora_dictionaries { + get => $this->get('collabora_dictionaries', ''); + set { + // This throws an exception if the validation fails. + $this->validateCollaboraDictionaries($value); + $this->set('collabora_dictionaries', $value); + } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -831,19 +843,10 @@ class ConfigurationManager return 'deck twofactor_totp tasks calendar contacts notes'; } - public function GetCollaboraDictionaries() : string { - $config = $this->GetConfig(); - if(!isset($config['collabora_dictionaries'])) { - $config['collabora_dictionaries'] = ''; - } - - return $config['collabora_dictionaries']; - } - /** * @throws InvalidSettingConfigurationException */ - public function SetCollaboraDictionaries(string $CollaboraDictionaries) : void { + private function validateCollaboraDictionaries(string $CollaboraDictionaries) : void { if ($CollaboraDictionaries === "") { throw new InvalidSettingConfigurationException("The dictionaries must not be empty!"); } @@ -851,16 +854,13 @@ class ConfigurationManager if (!preg_match("#^[a-zA-Z_ ]+$#", $CollaboraDictionaries)) { throw new InvalidSettingConfigurationException("The entered dictionaries do not seem to be a valid!"); } - - $config = $this->GetConfig(); - $config['collabora_dictionaries'] = $CollaboraDictionaries; - $this->WriteConfig($config); } + /** + * Provide an extra method since the corresponding attribute setter prevents setting an empty value. + */ public function DeleteCollaboraDictionaries() : void { - $config = $this->GetConfig(); - $config['collabora_dictionaries'] = ''; - $this->WriteConfig($config); + $this->set('collabora_dictionaries', ''); } /** diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index ae8e9c83..3bbc37f1 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -578,7 +578,7 @@ readonly class DockerActionManager { 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', 'TIMEZONE' => $this->configurationManager->timezone === '' ? 'Etc/UTC' : $this->configurationManager->timezone, - '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->collabora_dictionaries === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->configurationManager->collabora_dictionaries, 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', From 228440f2a8905aab4a2db54faa70fc8565776ffd Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:21:23 +0100 Subject: [PATCH 28/92] Make `collabora_additional_options` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- .../Controller/ConfigurationController.php | 4 +- php/src/Data/ConfigurationManager.php | 38 +++++++++---------- php/src/Docker/DockerActionManager.php | 4 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index dc0151e2..83d1d878 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -121,7 +121,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), 'talk_port' => $configurationManager->GetTalkPort(), 'collabora_dictionaries' => $configurationManager->collabora_dictionaries, - 'collabora_additional_options' => $configurationManager->GetAdditionalCollaboraOptions(), + 'collabora_additional_options' => $configurationManager->collabora_additional_options, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 4a36ce5c..3147fda4 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -121,12 +121,12 @@ readonly class ConfigurationController { } if (isset($request->getParsedBody()['delete_collabora_additional_options'])) { - $this->configurationManager->DeleteAdditionalCollaboraOptions(); + $this->configurationManager->deleteAdditionalCollaboraOptions(); } if (isset($request->getParsedBody()['collabora_additional_options'])) { $additionalCollaboraOptions = $request->getParsedBody()['collabora_additional_options'] ?? ''; - $this->configurationManager->SetAdditionalCollaboraOptions($additionalCollaboraOptions); + $this->configurationManager->collabora_additional_options = $additionalCollaboraOptions; } if (isset($request->getParsedBody()['delete_borg_backup_location_vars'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 9f037ec4..3c176556 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -148,6 +148,18 @@ class ConfigurationManager } } + /** + * @throws InvalidSettingConfigurationException + */ + public string $collabora_additional_options { + get => $this->get('collabora_additional_options', ''); + set { + // This throws an exception if the validation fails. + $this->validateCollaboraAdditionalOptions($value); + $this->set('collabora_additional_options', $value); + } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -866,7 +878,7 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException */ - public function SetAdditionalCollaboraOptions(string $additionalCollaboraOptions) : void { + private function validateCollaboraAdditionalOptions(string $additionalCollaboraOptions) : void { if ($additionalCollaboraOptions === "") { throw new InvalidSettingConfigurationException("The additional options must not be empty!"); } @@ -874,32 +886,20 @@ class ConfigurationManager if (!preg_match("#^--o:#", $additionalCollaboraOptions)) { throw new InvalidSettingConfigurationException("The entered options must start with '--o:'. So the config does not seem to be a valid!"); } - - $config = $this->GetConfig(); - $config['collabora_additional_options'] = $additionalCollaboraOptions; - $this->WriteConfig($config); - } - - public function GetAdditionalCollaboraOptions() : string { - $config = $this->GetConfig(); - if(!isset($config['collabora_additional_options'])) { - $config['collabora_additional_options'] = ''; - } - - return $config['collabora_additional_options']; } public function isCollaboraSubscriptionEnabled() : bool { - if (str_contains($this->GetAdditionalCollaboraOptions(), '--o:support_key=')) { + if (str_contains($this->collabora_additional_options, '--o:support_key=')) { return true; } return false; } - public function DeleteAdditionalCollaboraOptions() : void { - $config = $this->GetConfig(); - $config['collabora_additional_options'] = ''; - $this->WriteConfig($config); + /** + * Provide an extra method since the corresponding attribute setter prevents setting an empty value. + */ + public function deleteAdditionalCollaboraOptions() : void { + $this->set('collabora_additional_options', ''); } public function GetApacheAdditionalNetwork() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 3bbc37f1..6afa46fe 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -427,8 +427,8 @@ readonly class DockerActionManager { } // Additional Collabora options - if ($this->configurationManager->GetAdditionalCollaboraOptions() !== '') { - $requestBody['Cmd'] = [$this->configurationManager->GetAdditionalCollaboraOptions()]; + if ($this->configurationManager->collabora_additional_options !== '') { + $requestBody['Cmd'] = [$this->configurationManager->collabora_additional_options]; } } From 6c04cd055f363dc52d4e1bcac7a317f428246ebb Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 15:44:22 +0100 Subject: [PATCH 29/92] Make `aio_community_containers` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- .../Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 26 ++++--------------- php/src/Docker/DockerActionManager.php | 2 +- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 83d1d878..2d3e4f03 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -138,7 +138,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, 'community_containers' => $configurationManager->listAvailableCommunityContainers(), - 'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(), + 'community_containers_enabled' => $configurationManager->aio_community_containers, 'bypass_container_update' => $bypass_container_update, ]); })->setName('profile'); diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index e8244ddc..6f96d480 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -41,7 +41,7 @@ readonly class ContainerDefinitionFetcher { $data = json_decode((string)file_get_contents(DataConst::GetContainersDefinitionPath()), true, 512, JSON_THROW_ON_ERROR); $additionalContainerNames = []; - foreach ($this->configurationManager->GetEnabledCommunityContainers() as $communityContainer) { + foreach ($this->configurationManager->aio_community_containers as $communityContainer) { if ($communityContainer !== '') { $path = DataConst::GetCommunityContainersDirectory() . '/' . $communityContainer . '/' . $communityContainer . '.json'; $additionalData = json_decode((string)file_get_contents($path), true, 512, JSON_THROW_ON_ERROR); diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 3147fda4..a1132981 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -108,7 +108,7 @@ readonly class ConfigurationController { $enabledCC[] = $item; } } - $this->configurationManager->SetEnabledCommunityContainers($enabledCC); + $this->configurationManager->aio_community_containers = $enabledCC; } if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 3c176556..72f69086 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -160,6 +160,11 @@ class ConfigurationManager } } + public array $aio_community_containers { + get => explode(' ', $this->get('aio_community_containers', '')); + set { $this->set('aio_community_containers', implode(' ', $value)); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -931,16 +936,6 @@ class ConfigurationManager } } - private function GetCommunityContainers() : string { - $config = $this->GetConfig(); - if(!isset($config['aio_community_containers'])) { - $config['aio_community_containers'] = ''; - } - - return $config['aio_community_containers']; - } - - public function listAvailableCommunityContainers() : array { $cc = []; $dir = scandir(DataConst::GetCommunityContainersDirectory()); @@ -976,17 +971,6 @@ class ConfigurationManager return $cc; } - /** @return list */ - public function GetEnabledCommunityContainers(): array { - return explode(' ', $this->GetCommunityContainers()); - } - - public function SetEnabledCommunityContainers(array $enabledCommunityContainers) : void { - $config = $this->GetConfig(); - $config['aio_community_containers'] = implode(' ', $enabledCommunityContainers); - $this->WriteConfig($config); - } - private function GetEnabledDriDevice() : string { $envVariableName = 'NEXTCLOUD_ENABLE_DRI_DEVICE'; $configName = 'nextcloud_enable_dri_device'; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 6afa46fe..08cbf9b1 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -600,7 +600,7 @@ readonly class DockerActionManager { // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), // Allow to get local ip-address of caddy container and add it to trusted proxies automatically - 'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->GetEnabledCommunityContainers(), true) ? gethostbyname('nextcloud-aio-caddy') : '', + 'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->aio_community_containers, true) ? gethostbyname('nextcloud-aio-caddy') : '', 'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled ? 'yes' : '', default => $this->configurationManager->GetRegisteredSecret($placeholder), }; From 0a22384cd90127a14f11dc55b1e73c83daf485c4 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 12:23:22 +0100 Subject: [PATCH 30/92] Make `turn_domain` an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 14 +++++--------- php/src/Docker/DockerActionManager.php | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 72f69086..9362815a 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -165,6 +165,11 @@ class ConfigurationManager set { $this->set('aio_community_containers', implode(' ', $value)); } } + public string $turn_domain { + get => $this->get('turn_domain', ''); + set { $this->set('turn_domain', $value); } + } + public function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -562,15 +567,6 @@ class ConfigurationManager return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } - public function GetTurnDomain() : string { - $config = $this->GetConfig(); - if(!isset($config['turn_domain'])) { - $config['turn_domain'] = ''; - } - - return $config['turn_domain']; - } - /** * @throws InvalidSettingConfigurationException */ diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 08cbf9b1..367b7eb4 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -568,7 +568,7 @@ readonly class DockerActionManager { 'APACHE_PORT' => $this->configurationManager->GetApachePort(), 'APACHE_IP_BINDING' => $this->configurationManager->GetApacheIPBinding(), 'TALK_PORT' => $this->configurationManager->GetTalkPort(), - 'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(), + 'TURN_DOMAIN' => $this->configurationManager->turn_domain, 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password, 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '', From 4e373cb2f8a0be7e809f0a6d2cdc3700e5b8abf2 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:45:00 +0100 Subject: [PATCH 31/92] Make `apache_ip_binding` an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 12 +++++------- php/src/Docker/DockerActionManager.php | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 9362815a..7182602e 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -124,6 +124,11 @@ class ConfigurationManager set { $this->set('borg_restore_password', $value); } } + public string $apache_ip_binding { + get => $this->GetEnvironmentalVariableOrConfig('APACHE_IP_BINDING', 'apache_ip_binding', ''); + set { $this->set('apache_ip_binding', $value); } + } + /** * @throws InvalidSettingConfigurationException */ @@ -910,13 +915,6 @@ class ConfigurationManager return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } - public function GetApacheIPBinding() : string { - $envVariableName = 'APACHE_IP_BINDING'; - $configName = 'apache_ip_binding'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); - } - private function GetDisableBackupSection() : string { $envVariableName = 'AIO_DISABLE_BACKUP_SECTION'; $configName = 'disable_backup_section'; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 367b7eb4..b1bf847e 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -297,7 +297,7 @@ readonly class DockerActionManager { } $ipBinding = $value->ipBinding; if ($ipBinding === '%APACHE_IP_BINDING%') { - $ipBinding = $this->configurationManager->GetApacheIPBinding(); + $ipBinding = $this->configurationManager->apache_ip_binding; // Do not expose if AIO is in internal network mode if ($ipBinding === '@INTERNAL') { continue; @@ -566,7 +566,7 @@ readonly class DockerActionManager { 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->restoreExcludePreviews ? '1' : '', 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, 'APACHE_PORT' => $this->configurationManager->GetApachePort(), - 'APACHE_IP_BINDING' => $this->configurationManager->GetApacheIPBinding(), + 'APACHE_IP_BINDING' => $this->configurationManager->apache_ip_binding, 'TALK_PORT' => $this->configurationManager->GetTalkPort(), 'TURN_DOMAIN' => $this->configurationManager->turn_domain, 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), From dc28eb67372be8bc6848eb17c27673c1ae382bb4 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:47:45 +0100 Subject: [PATCH 32/92] Make `apache_port` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 10 ++++------ php/src/Docker/DockerActionManager.php | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 2d3e4f03..27364a98 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -92,7 +92,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ return $view->render($response, 'containers.twig', [ 'domain' => $configurationManager->domain, - 'apache_port' => $configurationManager->GetApachePort(), + 'apache_port' => $configurationManager->apache_port, 'borg_backup_host_location' => $configurationManager->borg_backup_host_location, 'borg_remote_repo' => $configurationManager->borg_remote_repo, 'borg_public_key' => $configurationManager->GetBorgPublicKey(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 7182602e..aaef8e08 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -363,7 +363,7 @@ class ConfigurationManager } // Get the apache port - $port = $this->GetApachePort(); + $port = $this->apache_port; if (!filter_var($dnsRecordIP, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { if ($port === '443') { @@ -558,11 +558,9 @@ class ConfigurationManager $this->set('password', $newPassword); } - public function GetApachePort() : string { - $envVariableName = 'APACHE_PORT'; - $configName = 'apache_port'; - $defaultValue = '443'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $apache_port { + get => $this->GetEnvironmentalVariableOrConfig('APACHE_PORT', 'apache_port', '443'); + set { $this->set('apache_port', $value); } } public function GetTalkPort() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index b1bf847e..0db11ade 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -115,7 +115,7 @@ readonly class DockerActionManager { $containerName = $container->identifier; $internalPort = $container->internalPorts; if ($internalPort === '%APACHE_PORT%') { - $internalPort = $this->configurationManager->GetApachePort(); + $internalPort = $this->configurationManager->apache_port; } elseif ($internalPort === '%TALK_PORT%') { $internalPort = $this->configurationManager->GetTalkPort(); } @@ -261,7 +261,7 @@ readonly class DockerActionManager { $port = $value->port; $protocol = $value->protocol; if ($port === '%APACHE_PORT%') { - $port = $this->configurationManager->GetApachePort(); + $port = $this->configurationManager->apache_port; // Do not expose udp if AIO is in reverse proxy mode if ($port !== '443' && $protocol === 'udp') { continue; @@ -283,7 +283,7 @@ readonly class DockerActionManager { $port = $value->port; $protocol = $value->protocol; if ($port === '%APACHE_PORT%') { - $port = $this->configurationManager->GetApachePort(); + $port = $this->configurationManager->apache_port; // Do not expose udp if AIO is in reverse proxy mode if ($port !== '443' && $protocol === 'udp') { continue; @@ -565,7 +565,7 @@ readonly class DockerActionManager { 'AIO_URL' => $this->configurationManager->AIO_URL, 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->restoreExcludePreviews ? '1' : '', 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, - 'APACHE_PORT' => $this->configurationManager->GetApachePort(), + 'APACHE_PORT' => $this->configurationManager->apache_port, 'APACHE_IP_BINDING' => $this->configurationManager->apache_ip_binding, 'TALK_PORT' => $this->configurationManager->GetTalkPort(), 'TURN_DOMAIN' => $this->configurationManager->turn_domain, From 96c9c1a6f91befbba4150d9312bc00173044ade9 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:52:24 +0100 Subject: [PATCH 33/92] Make `talk_port` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 10 ++++------ php/src/Docker/DockerActionManager.php | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 27364a98..718ad0ca 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -119,7 +119,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), 'timezone' => $configurationManager->timezone, 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), - 'talk_port' => $configurationManager->GetTalkPort(), + 'talk_port' => $configurationManager->talk_port, 'collabora_dictionaries' => $configurationManager->collabora_dictionaries, 'collabora_additional_options' => $configurationManager->collabora_additional_options, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index aaef8e08..fca733e9 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -562,12 +562,10 @@ class ConfigurationManager get => $this->GetEnvironmentalVariableOrConfig('APACHE_PORT', 'apache_port', '443'); set { $this->set('apache_port', $value); } } - - public function GetTalkPort() : string { - $envVariableName = 'TALK_PORT'; - $configName = 'talk_port'; - $defaultValue = '3478'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + + public string $talk_port { + get => $this->GetEnvironmentalVariableOrConfig('TALK_PORT', 'talk_port', '3478'); + set { $this->set('talk_port', $value); } } /** diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 0db11ade..8cfbe399 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -117,7 +117,7 @@ readonly class DockerActionManager { if ($internalPort === '%APACHE_PORT%') { $internalPort = $this->configurationManager->apache_port; } elseif ($internalPort === '%TALK_PORT%') { - $internalPort = $this->configurationManager->GetTalkPort(); + $internalPort = $this->configurationManager->talk_port; } if ($internalPort !== "" && $internalPort !== 'host') { @@ -267,7 +267,7 @@ readonly class DockerActionManager { continue; } } else if ($port === '%TALK_PORT%') { - $port = $this->configurationManager->GetTalkPort(); + $port = $this->configurationManager->talk_port; } $portWithProtocol = $port . '/' . $protocol; $exposedPorts[$portWithProtocol] = null; @@ -289,7 +289,7 @@ readonly class DockerActionManager { continue; } } else if ($port === '%TALK_PORT%') { - $port = $this->configurationManager->GetTalkPort(); + $port = $this->configurationManager->talk_port; // Skip publishing talk tcp port if it is set to 443 if ($port === '443' && $protocol === 'tcp') { continue; @@ -567,7 +567,7 @@ readonly class DockerActionManager { 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, 'APACHE_PORT' => $this->configurationManager->apache_port, 'APACHE_IP_BINDING' => $this->configurationManager->apache_ip_binding, - 'TALK_PORT' => $this->configurationManager->GetTalkPort(), + 'TALK_PORT' => $this->configurationManager->talk_port, 'TURN_DOMAIN' => $this->configurationManager->turn_domain, 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password, From 903aed1e34797c0fcaaa6bde13fe83b9cd77000f Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:54:14 +0100 Subject: [PATCH 34/92] Make `nextcloud_upload_limit` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 11 ++++------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 718ad0ca..b14bb449 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -129,7 +129,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), 'nextcloud_mount' => $configurationManager->GetNextcloudMount(), - 'nextcloud_upload_limit' => $configurationManager->GetNextcloudUploadLimit(), + 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), 'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(), 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index fca733e9..f9525c09 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -634,13 +634,10 @@ class ConfigurationManager return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } - public function GetNextcloudUploadLimit() : string { - $envVariableName = 'NEXTCLOUD_UPLOAD_LIMIT'; - $configName = 'nextcloud_upload_limit'; - $defaultValue = '16G'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $nextcloud_upload_limit { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_UPLOAD_LIMIT', 'nextcloud_upload_limit', '16G'); + set { $this->set('nextcloud_upload_limit', $value); } } - public function GetNextcloudMemoryLimit() : string { $envVariableName = 'NEXTCLOUD_MEMORY_LIMIT'; $configName = 'nextcloud_memory_limit'; @@ -649,7 +646,7 @@ class ConfigurationManager } public function GetApacheMaxSize() : int { - $uploadLimit = (int)rtrim($this->GetNextcloudUploadLimit(), 'G'); + $uploadLimit = (int)rtrim($this->nextcloud_upload_limit, 'G'); return $uploadLimit * 1024 * 1024 * 1024; } diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 8cfbe399..d42678a7 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -582,7 +582,7 @@ readonly class DockerActionManager { 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', - 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->GetNextcloudUploadLimit(), + 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->nextcloud_upload_limit, 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(), 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->GetNextcloudMaxTime(), 'BORG_RETENTION_POLICY' => $this->configurationManager->GetBorgRetentionPolicy(), From 4de73dd75b865b6e5a1e0488ca0e92d30efbbbd8 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:53:22 +0100 Subject: [PATCH 35/92] Make `nextcloud_mount` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- php/src/Data/ConfigurationManager.php | 8 +++----- php/src/Docker/DockerActionManager.php | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index b14bb449..a87449fc 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -128,7 +128,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), - 'nextcloud_mount' => $configurationManager->GetNextcloudMount(), + 'nextcloud_mount' => $configurationManager->nextcloud_mount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), 'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 6f96d480..c81989f2 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -119,7 +119,7 @@ readonly class ContainerDefinitionFetcher { } } if($value['source'] === '%NEXTCLOUD_MOUNT%') { - $value['source'] = $this->configurationManager->GetNextcloudMount(); + $value['source'] = $this->configurationManager->nextcloud_mount; if($value['source'] === '') { continue; } @@ -140,7 +140,7 @@ readonly class ContainerDefinitionFetcher { } } if ($value['destination'] === '%NEXTCLOUD_MOUNT%') { - $value['destination'] = $this->configurationManager->GetNextcloudMount(); + $value['destination'] = $this->configurationManager->nextcloud_mount; if($value['destination'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index f9525c09..da823439 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -620,11 +620,9 @@ class ConfigurationManager return trim((string)file_get_contents(DataConst::GetBackupPublicKey())); } - public function GetNextcloudMount() : string { - $envVariableName = 'NEXTCLOUD_MOUNT'; - $configName = 'nextcloud_mount'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $nextcloud_mount { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MOUNT', 'nextcloud_mount', ''); + set { $this->set('nextcloud_mount', $value); } } public function GetNextcloudDatadirMount() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index d42678a7..7ab3bc23 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -205,7 +205,7 @@ readonly class DockerActionManager { foreach ($container->volumes->GetVolumes() as $volume) { // // NEXTCLOUD_MOUNT gets added via bind-mount later on // if ($container->identifier === 'nextcloud-aio-nextcloud') { - // if ($volume->name === $this->configurationManager->GetNextcloudMount()) { + // if ($volume->name === $this->configurationManager->nextcloud_mount) { // continue; // } // } @@ -408,7 +408,7 @@ readonly class DockerActionManager { // // Special things for the nextcloud container which should not be exposed in the containers.json // } elseif ($container->identifier === 'nextcloud-aio-nextcloud') { // foreach ($container->volumes->GetVolumes() as $volume) { - // if ($volume->name !== $this->configurationManager->GetNextcloudMount()) { + // if ($volume->name !== $this->configurationManager->nextcloud_mount) { // continue; // } // $mounts[] = ["Type" => "bind", "Source" => $volume->name, "Target" => $volume->mountPoint, "ReadOnly" => !$volume->isWritable, "BindOptions" => [ "Propagation" => "rshared"]]; @@ -569,7 +569,7 @@ readonly class DockerActionManager { 'APACHE_IP_BINDING' => $this->configurationManager->apache_ip_binding, 'TALK_PORT' => $this->configurationManager->talk_port, 'TURN_DOMAIN' => $this->configurationManager->turn_domain, - 'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(), + 'NEXTCLOUD_MOUNT' => $this->configurationManager->nextcloud_mount, 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password, 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '', 'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled ? 'yes' : '', From 3e19fa66d0271eb3b656a0aebab90e17383f6406 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:51:30 +0100 Subject: [PATCH 36/92] Make `nextcloud_datadir_mount` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index a87449fc..e312a7df 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -127,7 +127,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), - 'nextcloud_datadir' => $configurationManager->GetNextcloudDatadirMount(), + 'nextcloud_datadir' => $configurationManager->nextcloud_datadir_mount, 'nextcloud_mount' => $configurationManager->nextcloud_mount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index c81989f2..22309da8 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -124,7 +124,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value['source'] === '%NEXTCLOUD_DATADIR%') { - $value['source'] = $this->configurationManager->GetNextcloudDatadirMount(); + $value['source'] = $this->configurationManager->nextcloud_datadir_mount; if ($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index da823439..b2dd40fb 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -473,8 +473,8 @@ class ConfigurationManager // Prevent backup to be contained in Nextcloud Datadir as this will delete the backup archive upon restore // See https://github.com/nextcloud/all-in-one/issues/6607 - if (str_starts_with($location . '/', rtrim($this->GetNextcloudDatadirMount(), '/') . '/')) { - throw new InvalidSettingConfigurationException("The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to " . $this->GetNextcloudDatadirMount()); + if (str_starts_with($location . '/', rtrim($this->nextcloud_datadir_mount, '/') . '/')) { + throw new InvalidSettingConfigurationException("The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to " . $this->nextcloud_datadir_mount); } } else { @@ -625,11 +625,10 @@ class ConfigurationManager set { $this->set('nextcloud_mount', $value); } } - public function GetNextcloudDatadirMount() : string { - $envVariableName = 'NEXTCLOUD_DATADIR'; - $configName = 'nextcloud_datadir'; - $defaultValue = 'nextcloud_aio_nextcloud_data'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + + public string $nextcloud_datadir_mount { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_DATADIR', 'nextcloud_datadir', 'nextcloud_aio_nextcloud_data'); + set { $this->set('nextcloud_datadir_mount', $value); } } public string $nextcloud_upload_limit { From c1f8ac6989e9a0064c6012546f0f6060fccac190 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:54:54 +0100 Subject: [PATCH 37/92] Make `nextcloud_memory_limit` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 9 ++++----- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index e312a7df..7bace4ac 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -131,7 +131,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_mount' => $configurationManager->nextcloud_mount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), - 'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(), + 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b2dd40fb..c466bb3c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -635,11 +635,10 @@ class ConfigurationManager get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_UPLOAD_LIMIT', 'nextcloud_upload_limit', '16G'); set { $this->set('nextcloud_upload_limit', $value); } } - public function GetNextcloudMemoryLimit() : string { - $envVariableName = 'NEXTCLOUD_MEMORY_LIMIT'; - $configName = 'nextcloud_memory_limit'; - $defaultValue = '512M'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + + public string $nextcloud_memory_limit { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MEMORY_LIMIT', 'nextcloud_memory_limit', '512M'); + set { $this->set('nextcloud_memory_limit', $value); } } public function GetApacheMaxSize() : int { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 7ab3bc23..ee3cee60 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -583,7 +583,7 @@ readonly class DockerActionManager { 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->nextcloud_upload_limit, - 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->GetNextcloudMemoryLimit(), + 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->nextcloud_memory_limit, 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->GetNextcloudMaxTime(), 'BORG_RETENTION_POLICY' => $this->configurationManager->GetBorgRetentionPolicy(), 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->configurationManager->GetFulltextsearchJavaOptions(), From 367e847cc813a674c8977c3b0e7e635588838dda Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 12:55:58 +0100 Subject: [PATCH 38/92] Make `nextcloud_max_time` an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 8 +++----- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 7bace4ac..d4f4799f 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -130,7 +130,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_datadir' => $configurationManager->nextcloud_datadir_mount, 'nextcloud_mount' => $configurationManager->nextcloud_mount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, - 'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(), + 'nextcloud_max_time' => $configurationManager->nextcloud_max_time, 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index c466bb3c..44c8cc62 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -646,11 +646,9 @@ class ConfigurationManager return $uploadLimit * 1024 * 1024 * 1024; } - public function GetNextcloudMaxTime() : string { - $envVariableName = 'NEXTCLOUD_MAX_TIME'; - $configName = 'nextcloud_max_time'; - $defaultValue = '3600'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $nextcloud_max_time { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MAX_TIME', 'nextcloud_max_time', '3600'); + set { $this->set('nextcloud_max_time', $value); } } public function GetBorgRetentionPolicy() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index ee3cee60..b14e31db 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -584,7 +584,7 @@ readonly class DockerActionManager { 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->nextcloud_upload_limit, 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->nextcloud_memory_limit, - 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->GetNextcloudMaxTime(), + 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->nextcloud_max_time, 'BORG_RETENTION_POLICY' => $this->configurationManager->GetBorgRetentionPolicy(), 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->configurationManager->GetFulltextsearchJavaOptions(), 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->configurationManager->GetTrustedCacertsDir(), From f1ffd0771ce86e253e40e16ef4996fe16a960c76 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 14:28:15 +0100 Subject: [PATCH 39/92] Privatize GetConfig() and WriteConfig() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 44c8cc62..e172d19b 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -175,7 +175,7 @@ class ConfigurationManager set { $this->set('turn_domain', $value); } } - public function GetConfig() : array + private function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) { @@ -571,10 +571,7 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException */ - public function WriteConfig(?array $config) : void { - if ($config) { - $this->config = $config; - } + private function WriteConfig() : void { if(!is_dir(DataConst::GetDataDirectory())) { throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!"); } From c997332e47e26473536fbffa5e6881293814f369 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 18:28:58 +0100 Subject: [PATCH 40/92] Remove residue code Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e172d19b..b30e6fc3 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -419,8 +419,6 @@ class ConfigurationManager } } - $config = $this->GetConfig(); - $this->WriteConfig($config); $this->setMultiple(function ($confManager) use ($domain) { // Write domain // Don't set the domain via the attribute, or we create a loop. @@ -443,9 +441,6 @@ class ConfigurationManager */ public function SetBorgLocationVars(string $location, string $repo) : void { $this->ValidateBorgLocationVars($location, $repo); - - $config = $this->GetConfig(); - $this->WriteConfig($config); $this->setMultiple(function ($confManager) use ($location, $repo) { $confManager->borg_backup_host_location = $location; $confManager->borg_remote_repo = $repo; @@ -495,8 +490,6 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables - $config = $this->GetConfig(); - $this->WriteConfig($config); $this->setMultiple(function ($confManager) { $confManager->borg_backup_host_location = ''; $confManager->borg_remote_repo = ''; @@ -520,8 +513,6 @@ class ConfigurationManager throw new InvalidSettingConfigurationException("Please enter the password!"); } - $config = $this->GetConfig(); - $this->WriteConfig($config); $this->setMultiple(function ($confManager) use ($location, $repo, $password) { $confManager->borg_backup_host_location = $location; $confManager->borg_remote_repo = $repo; From 9c9ad02f8a830f210494ea141fbcf400bb87fbd7 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 16:31:29 +0100 Subject: [PATCH 41/92] Set multiple attributes at once Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 4e6d52b7..f1c5400d 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -123,9 +123,11 @@ readonly class DockerController { } public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { - $this->configurationManager->backupMode = 'restore'; - $this->configurationManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; - $this->configurationManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); + $this->configurationManager->setMultiple(function ($confManager) use ($request) { + $confManager->backupMode = 'restore'; + $confManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; + $confManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); + }); $id = self::TOP_CONTAINER; $forceStopNextcloud = true; @@ -150,8 +152,10 @@ readonly class DockerController { } public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { - $this->configurationManager->backupMode = 'test'; - $this->configurationManager->instance_restore_attempt = false; + $this->configurationManager->setMultiple(function ($confManager) { + $confManager->backupMode = 'test'; + $confManager->instance_restore_attempt = false; + }); $id = self::TOP_CONTAINER; $this->PerformRecursiveContainerStop($id); @@ -173,12 +177,13 @@ readonly class DockerController { $port = 443; } - $this->configurationManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); - // set AIO_URL - $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; - // set wasStartButtonClicked - $this->configurationManager->wasStartButtonClicked = true; - + $this->configurationManager->setMultiple(function ($confManager) use ($request, $host, $port, $path) { + $confManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); + // set AIO_URL + $confManager->AIO_URL = $host . ':' . (string)$port . $path; + // set wasStartButtonClicked + $confManager->wasStartButtonClicked = true; + }); // Do not pull container images in case 'bypass_container_update' is set via url params // Needed for local testing $pullImage = !isset($request->getParsedBody()['bypass_container_update']); From 844831a899fd075adcd820b307faac0c81b20eb8 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 09:27:43 +0100 Subject: [PATCH 42/92] Move handling ENV-var replacement into ConfigurationManger It's the more appropriate place to have this code, and we had to touch it anyways to make it assign the values to the attributes. Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 93 ++++++++++++++++++++++++++ php/src/Docker/DockerActionManager.php | 88 +----------------------- 2 files changed, 95 insertions(+), 86 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b30e6fc3..2cbae5cc 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -980,4 +980,97 @@ class ConfigurationManager return true; } } + + public function setAioVariables(array $input) : void { + if ($input === []) { + return; + } + $this->setMultiple(function($confManager) use ($input) { + foreach ($input as $variable) { + $keyWithValue = $confManager->replaceEnvPlaceholders($variable); + [$key, $value] = explode('=', $keyWithValue, 2); + // Set if there's an attribute corresponding to the key. + if (isset($key, $confManager->$key)) { + $confManager->$key = $value; + } + } + }); + } + + // + // Replaces placeholders in $envValue with their values. + // E.g. "%NC_DOMAIN%:%APACHE_PORT" becomes "my.nextcloud.com:11000" + public function replaceEnvPlaceholders(string $envValue): string { + // $pattern breaks down as: + // % - matches a literal percent sign + // ([^%]+) - capture group that matches one or more characters that are NOT percent signs + // % - matches the closing percent sign + // + // Assumes literal percent signs are always matched and there is no + // escaping. + $pattern = '/%([^%]+)%/'; + $matchCount = preg_match_all($pattern, $envValue, $matches); + + if ($matchCount === 0) { + return $envValue; + } + + $placeholders = $matches[0]; // ["%PLACEHOLDER1%", "%PLACEHOLDER2%", ...] + $placeholderNames = $matches[1]; // ["PLACEHOLDER1", "PLACEHOLDER2", ...] + $placeholderPatterns = array_map(static fn(string $p) => '/' . preg_quote($p) . '/', $placeholders); // ["/%PLACEHOLDER1%/", ...] + $placeholderValues = array_map($this->getPlaceholderValue(...), $placeholderNames); // ["val1", "val2"] + // Guaranteed to be non-null because we found the placeholders in the preg_match_all. + return (string) preg_replace($placeholderPatterns, $placeholderValues, $envValue); + } + + private function getPlaceholderValue(string $placeholder) : string { + return match ($placeholder) { + 'NC_DOMAIN' => $this->domain, + 'NC_BASE_DN' => $this->GetBaseDN(), + 'AIO_TOKEN' => $this->AIO_TOKEN, + 'BORGBACKUP_REMOTE_REPO' => $this->borg_remote_repo, + 'BORGBACKUP_MODE' => $this->backupMode, + 'AIO_URL' => $this->AIO_URL, + 'SELECTED_RESTORE_TIME' => $this->selectedRestoreTime, + 'RESTORE_EXCLUDE_PREVIEWS' => $this->restoreExcludePreviews ? '1' : '', + 'APACHE_PORT' => $this->apache_port, + 'APACHE_IP_BINDING' => $this->apache_ip_binding, + 'TALK_PORT' => $this->talk_port, + 'TURN_DOMAIN' => $this->turn_domain, + 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, + 'BACKUP_RESTORE_PASSWORD' => $this->borg_restore_password, + 'CLAMAV_ENABLED' => $this->isClamavEnabled ? 'yes' : '', + 'TALK_RECORDING_ENABLED' => $this->isTalkRecordingEnabled ? 'yes' : '', + 'ONLYOFFICE_ENABLED' => $this->isOnlyofficeEnabled ? 'yes' : '', + 'COLLABORA_ENABLED' => $this->isCollaboraEnabled ? 'yes' : '', + 'TALK_ENABLED' => $this->isTalkEnabled ? 'yes' : '', + 'UPDATE_NEXTCLOUD_APPS' => ($this->isDailyBackupRunning() && $this->areAutomaticUpdatesEnabled()) ? 'yes' : '', + 'TIMEZONE' => $this->timezone === '' ? 'Etc/UTC' : $this->timezone, + 'COLLABORA_DICTIONARIES' => $this->collabora_dictionaries === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->collabora_dictionaries, + 'IMAGINARY_ENABLED' => $this->isImaginaryEnabled ? 'yes' : '', + 'FULLTEXTSEARCH_ENABLED' => $this->isFulltextsearchEnabled ? 'yes' : '', + 'DOCKER_SOCKET_PROXY_ENABLED' => $this->isDockerSocketProxyEnabled ? 'yes' : '', + 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloud_upload_limit, + 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloud_memory_limit, + 'NEXTCLOUD_MAX_TIME' => $this->nextcloud_max_time, + 'BORG_RETENTION_POLICY' => $this->GetBorgRetentionPolicy(), + 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), + 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), + 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', + 'BORGBACKUP_HOST_LOCATION' => $this->borg_backup_host_location, + 'APACHE_MAX_SIZE' => (string)($this->GetApacheMaxSize()), + 'COLLABORA_SECCOMP_POLICY' => $this->GetCollaboraSeccompPolicy(), + 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), + 'NEXTCLOUD_ADDITIONAL_APKS' => $this->GetNextcloudAdditionalApks(), + 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->GetNextcloudAdditionalPhpExtensions(), + 'INSTALL_LATEST_MAJOR' => $this->install_latest_major ? 'yes' : '', + 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', + // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) + 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), + // Allow to get local ip-address of caddy container and add it to trusted proxies automatically + 'CADDY_IP_ADDRESS' => in_array('caddy', $this->aio_community_containers, true) ? gethostbyname('nextcloud-aio-caddy') : '', + 'WHITEBOARD_ENABLED' => $this->isWhiteboardEnabled ? 'yes' : '', + default => $this->GetRegisteredSecret($placeholder), + }; + } } diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index b14e31db..832480c2 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -228,15 +228,7 @@ readonly class DockerActionManager { $requestBody['HostConfig']['Binds'] = $volumes; } - $aioVariables = $container->aioVariables->GetVariables(); - foreach ($aioVariables as $variable) { - $config = $this->configurationManager->GetConfig(); - $variable = $this->replaceEnvPlaceholders($variable); - $variableArray = explode('=', $variable); - $config[$variableArray[0]] = $variableArray[1]; - $this->configurationManager->WriteConfig($config); - sleep(1); - } + $this->configurationManager->setAioVariables($container->aioVariables->GetVariables()); $envs = $container->containerEnvironmentVariables->GetVariables(); // Special thing for the nextcloud container @@ -244,7 +236,7 @@ readonly class DockerActionManager { $envs[] = $this->GetAllNextcloudExecCommands(); } foreach ($envs as $key => $env) { - $envs[$key] = $this->replaceEnvPlaceholders($env); + $envs[$key] = $this->configurationManager->replaceEnvPlaceholders($env); } if (count($envs) > 0) { @@ -530,82 +522,6 @@ readonly class DockerActionManager { } } - // Replaces placeholders in $envValue with their values. - // E.g. "%NC_DOMAIN%:%APACHE_PORT" becomes "my.nextcloud.com:11000" - private function replaceEnvPlaceholders(string $envValue): string { - // $pattern breaks down as: - // % - matches a literal percent sign - // ([^%]+) - capture group that matches one or more characters that are NOT percent signs - // % - matches the closing percent sign - // - // Assumes literal percent signs are always matched and there is no - // escaping. - $pattern = '/%([^%]+)%/'; - $matchCount = preg_match_all($pattern, $envValue, $matches); - - if ($matchCount === 0) { - return $envValue; - } - - $placeholders = $matches[0]; // ["%PLACEHOLDER1%", "%PLACEHOLDER2%", ...] - $placeholderNames = $matches[1]; // ["PLACEHOLDER1", "PLACEHOLDER2", ...] - $placeholderPatterns = array_map(static fn(string $p) => '/' . preg_quote($p) . '/', $placeholders); // ["/%PLACEHOLDER1%/", ...] - $placeholderValues = array_map($this->getPlaceholderValue(...), $placeholderNames); // ["val1", "val2"] - // Guaranteed to be non-null because we found the placeholders in the preg_match_all. - return (string) preg_replace($placeholderPatterns, $placeholderValues, $envValue); - } - - private function getPlaceholderValue(string $placeholder) : string { - return match ($placeholder) { - 'NC_DOMAIN' => $this->configurationManager->GetDomain(), - 'NC_BASE_DN' => $this->configurationManager->GetBaseDN(), - 'AIO_TOKEN' => $this->configurationManager->AIO_TOKEN, - 'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->borg_remote_repo, - 'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(), - 'AIO_URL' => $this->configurationManager->AIO_URL, - 'RESTORE_EXCLUDE_PREVIEWS' => $this->configurationManager->restoreExcludePreviews ? '1' : '', - 'SELECTED_RESTORE_TIME' => $this->configurationManager->selectedRestoreTime, - 'APACHE_PORT' => $this->configurationManager->apache_port, - 'APACHE_IP_BINDING' => $this->configurationManager->apache_ip_binding, - 'TALK_PORT' => $this->configurationManager->talk_port, - 'TURN_DOMAIN' => $this->configurationManager->turn_domain, - 'NEXTCLOUD_MOUNT' => $this->configurationManager->nextcloud_mount, - 'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password, - 'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '', - 'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled ? 'yes' : '', - 'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '', - 'COLLABORA_ENABLED' => $this->configurationManager->isCollaboraEnabled ? 'yes' : '', - 'TALK_ENABLED' => $this->configurationManager->isTalkEnabled ? 'yes' : '', - 'UPDATE_NEXTCLOUD_APPS' => ($this->configurationManager->isDailyBackupRunning() && $this->configurationManager->areAutomaticUpdatesEnabled()) ? 'yes' : '', - 'TIMEZONE' => $this->configurationManager->timezone === '' ? 'Etc/UTC' : $this->configurationManager->timezone, - 'COLLABORA_DICTIONARIES' => $this->configurationManager->collabora_dictionaries === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->configurationManager->collabora_dictionaries, - 'IMAGINARY_ENABLED' => $this->configurationManager->isImaginaryEnabled ? 'yes' : '', - 'FULLTEXTSEARCH_ENABLED' => $this->configurationManager->isFulltextsearchEnabled ? 'yes' : '', - 'DOCKER_SOCKET_PROXY_ENABLED' => $this->configurationManager->isDockerSocketProxyEnabled ? 'yes' : '', - 'NEXTCLOUD_UPLOAD_LIMIT' => $this->configurationManager->nextcloud_upload_limit, - 'NEXTCLOUD_MEMORY_LIMIT' => $this->configurationManager->nextcloud_memory_limit, - 'NEXTCLOUD_MAX_TIME' => $this->configurationManager->nextcloud_max_time, - 'BORG_RETENTION_POLICY' => $this->configurationManager->GetBorgRetentionPolicy(), - 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->configurationManager->GetFulltextsearchJavaOptions(), - 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->configurationManager->GetTrustedCacertsDir(), - 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->configurationManager->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', - 'BORGBACKUP_HOST_LOCATION' => $this->configurationManager->borg_backup_host_location, - 'APACHE_MAX_SIZE' => (string)($this->configurationManager->GetApacheMaxSize()), - 'COLLABORA_SECCOMP_POLICY' => $this->configurationManager->GetCollaboraSeccompPolicy(), - 'NEXTCLOUD_STARTUP_APPS' => $this->configurationManager->GetNextcloudStartupApps(), - 'NEXTCLOUD_ADDITIONAL_APKS' => $this->configurationManager->GetNextcloudAdditionalApks(), - 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->configurationManager->GetNextcloudAdditionalPhpExtensions(), - 'INSTALL_LATEST_MAJOR' => $this->configurationManager->install_latest_major ? 'yes' : '', - 'REMOVE_DISABLED_APPS' => $this->configurationManager->shouldDisabledAppsGetRemoved() ? 'yes' : '', - // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) - 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), - // Allow to get local ip-address of caddy container and add it to trusted proxies automatically - 'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->aio_community_containers, true) ? gethostbyname('nextcloud-aio-caddy') : '', - 'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled ? 'yes' : '', - default => $this->configurationManager->GetRegisteredSecret($placeholder), - }; - } - private function isContainerUpdateAvailable(string $id): string { $container = $this->containerDefinitionFetcher->GetContainerById($id); From fd308d4b802c31169fb2df2189daad638c32a7ce Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 15:18:13 +0100 Subject: [PATCH 43/92] Simplify some code a little bit Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2cbae5cc..19ff0b74 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -697,10 +697,7 @@ class ConfigurationManager } public function isSeccompDisabled() : bool { - if ($this->GetCollaboraSeccompDisabledState() === 'true') { - return true; - } - return false; + return $this->GetCollaboraSeccompDisabledState() === 'true'; } /** @@ -795,10 +792,7 @@ class ConfigurationManager } public function isDailyBackupRunning() : bool { - if (file_exists(DataConst::GetDailyBackupBlockFile())) { - return true; - } - return false; + return file_exists(DataConst::GetDailyBackupBlockFile()); } /** @@ -870,10 +864,7 @@ class ConfigurationManager } public function isCollaboraSubscriptionEnabled() : bool { - if (str_contains($this->collabora_additional_options, '--o:support_key=')) { - return true; - } - return false; + return str_contains($this->collabora_additional_options, '--o:support_key='); } /** From 662840bc25444fb1081af602a0143c6cea2f75ae Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 19:36:39 +0100 Subject: [PATCH 44/92] Make psalm accept the property-hooks for virtual attributes Signed-off-by: Pablo Zmdl --- php/psalm.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php/psalm.xml b/php/psalm.xml index d7ce38c9..576d82d2 100644 --- a/php/psalm.xml +++ b/php/psalm.xml @@ -20,5 +20,10 @@ + + + + + From 77bec5898f84de1e0f9dd66bf3e0ceef8919abf5 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 20 Jan 2026 19:34:52 +0100 Subject: [PATCH 45/92] Type for Closure argument Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 6 +++--- php/src/Data/ConfigurationManager.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index f1c5400d..c60efda5 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -123,7 +123,7 @@ readonly class DockerController { } public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { - $this->configurationManager->setMultiple(function ($confManager) use ($request) { + $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) use ($request) { $confManager->backupMode = 'restore'; $confManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; $confManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); @@ -152,7 +152,7 @@ readonly class DockerController { } public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { - $this->configurationManager->setMultiple(function ($confManager) { + $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) { $confManager->backupMode = 'test'; $confManager->instance_restore_attempt = false; }); @@ -177,7 +177,7 @@ readonly class DockerController { $port = 443; } - $this->configurationManager->setMultiple(function ($confManager) use ($request, $host, $port, $path) { + $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) use ($request, $host, $port, $path) { $confManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); // set AIO_URL $confManager->AIO_URL = $host . ':' . (string)$port . $path; diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 19ff0b74..2fb0a413 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -419,7 +419,7 @@ class ConfigurationManager } } - $this->setMultiple(function ($confManager) use ($domain) { + $this->setMultiple(function (ConfigurationManager $confManager) use ($domain) { // Write domain // Don't set the domain via the attribute, or we create a loop. $confManager->set('domain', $domain); @@ -441,7 +441,7 @@ class ConfigurationManager */ public function SetBorgLocationVars(string $location, string $repo) : void { $this->ValidateBorgLocationVars($location, $repo); - $this->setMultiple(function ($confManager) use ($location, $repo) { + $this->setMultiple(function (ConfigurationManager $confManager) use ($location, $repo) { $confManager->borg_backup_host_location = $location; $confManager->borg_remote_repo = $repo; }); @@ -490,7 +490,7 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables - $this->setMultiple(function ($confManager) { + $this->setMultiple(function (ConfigurationManager $confManager) { $confManager->borg_backup_host_location = ''; $confManager->borg_remote_repo = ''; }); @@ -513,7 +513,7 @@ class ConfigurationManager throw new InvalidSettingConfigurationException("Please enter the password!"); } - $this->setMultiple(function ($confManager) use ($location, $repo, $password) { + $this->setMultiple(function (ConfigurationManager $confManager) use ($location, $repo, $password) { $confManager->borg_backup_host_location = $location; $confManager->borg_remote_repo = $repo; $confManager->borg_restore_password = $password; @@ -976,7 +976,7 @@ class ConfigurationManager if ($input === []) { return; } - $this->setMultiple(function($confManager) use ($input) { + $this->setMultiple(function(ConfigurationManager $confManager) use ($input) { foreach ($input as $variable) { $keyWithValue = $confManager->replaceEnvPlaceholders($variable); [$key, $value] = explode('=', $keyWithValue, 2); From c65ccd2db02f7dfbf664ce17b7ca07036d5d4516 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Wed, 21 Jan 2026 09:54:29 +0100 Subject: [PATCH 46/92] Make aio-variables code more robust and psalm-compatible Now the input gets checked for being useful. It's user-generated data in the end, which might be "funny" in curious ways. psalm complained about the possibly unset second array key in the destructuring assignment of `$key` and `$value`, which won't happen due to the check for a present equal sign earlier, but nonetheless this way the code is more robust. Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2fb0a413..2863d6e8 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -978,10 +978,19 @@ class ConfigurationManager } $this->setMultiple(function(ConfigurationManager $confManager) use ($input) { foreach ($input as $variable) { + if (!is_string($variable) || !str_contains($variable, '=')) { + error_log("Invalid input: '$variable' is not a string or does not contain an equal sign ('=')"); + continue; + } $keyWithValue = $confManager->replaceEnvPlaceholders($variable); - [$key, $value] = explode('=', $keyWithValue, 2); - // Set if there's an attribute corresponding to the key. - if (isset($key, $confManager->$key)) { + // Pad the result with nulls so psalm is happy (and we don't risk to run into warnings in case + // the check for an equal sign from above gets changed). + [$key, $value] = explode('=', $keyWithValue, 2) + [null, null]; + if ($value === null) { + error_log("Invalid input: '$keyWithValue' has no value after the equal sign"); + } else if (!property_exists($confManager, $key)) { + error_log("Error: '$key' is not a valid configuration key (in '$keyWithValue')"); + } else { $confManager->$key = $value; } } From 6bf45fb5072788a4926a4c3175f996b97b10fc10 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Wed, 21 Jan 2026 13:11:45 +0100 Subject: [PATCH 47/92] A script to list AIO variables that are configurable through `aio_variables` in community containers Signed-off-by: Pablo Zmdl --- get-configurable-aio-variables.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 get-configurable-aio-variables.sh diff --git a/get-configurable-aio-variables.sh b/get-configurable-aio-variables.sh new file mode 100755 index 00000000..44536bd3 --- /dev/null +++ b/get-configurable-aio-variables.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +awk '/^ public [^f][^u][^n]/ { sub(/\$/, "", $3); print $3 }' php/src/Data/ConfigurationManager.php | sort From 76d475f2b249aa6447b96d89a1eae56875fb8b34 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 16:40:45 +0100 Subject: [PATCH 48/92] Replace setMultiple() by startTransaction() and commitTransaction() Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 33 ++++----- php/src/Data/ConfigurationManager.php | 96 +++++++++++++------------ 2 files changed, 68 insertions(+), 61 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index c60efda5..7078b71f 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -123,11 +123,11 @@ readonly class DockerController { } public function StartBackupContainerRestore(Request $request, Response $response, array $args) : Response { - $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) use ($request) { - $confManager->backupMode = 'restore'; - $confManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; - $confManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); - }); + $this->configurationManager->startTransaction(); + $this->configurationManager->backupMode = 'restore'; + $this->configurationManager->selectedRestoreTime = $request->getParsedBody()['selected_restore_time'] ?? ''; + $this->configurationManager->restoreExcludePreviews = isset($request->getParsedBody()['restore-exclude-previews']); + $this->configurationManager->commitTransaction(); $id = self::TOP_CONTAINER; $forceStopNextcloud = true; @@ -152,10 +152,10 @@ readonly class DockerController { } public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { - $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) { - $confManager->backupMode = 'test'; - $confManager->instance_restore_attempt = false; - }); + $this->configurationManager->startTransaction(); + $this->configurationManager->backupMode = 'test'; + $this->configurationManager->instance_restore_attempt = false; + $this->configurationManager->commitTransaction(); $id = self::TOP_CONTAINER; $this->PerformRecursiveContainerStop($id); @@ -177,13 +177,14 @@ readonly class DockerController { $port = 443; } - $this->configurationManager->setMultiple(function (ConfigurationManager $confManager) use ($request, $host, $port, $path) { - $confManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); - // set AIO_URL - $confManager->AIO_URL = $host . ':' . (string)$port . $path; - // set wasStartButtonClicked - $confManager->wasStartButtonClicked = true; - }); + $this->configurationManager->startTransaction(); + $this->configurationManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); + // set AIO_URL + $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; + // set wasStartButtonClicked + $this->configurationManager->wasStartButtonClicked = true; + $this->configurationManager->commitTransaction(); + // Do not pull container images in case 'bypass_container_update' is set via url params // Needed for local testing $pullImage = !isset($request->getParsedBody()['bypass_container_update']); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2863d6e8..2caf7849 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -193,21 +193,26 @@ class ConfigurationManager private function set(string $key, mixed $value) : void { $this->GetConfig(); $this->config[$key] = $value; - // Only write if this isn't called via setMultiple(). + // Only write if this isn't called in between startTransaction() and commitTransaction(). if ($this->noWrite !== true) { $this->WriteConfig(); } } /** - * This allows to assign multiple attributes without saving the config to disk in between (as would - * calling set() do). + * This allows to assign multiple attributes without saving the config to disk in between. It must be + * followed by a call to commitTransaction(), which then writes all changes to disk. */ - public function setMultiple(\Closure $closure) : void { + public function startTransaction() : void { + $this->GetConfig(); $this->noWrite = true; + } + + /** + * This allows to assign multiple attributes without saving the config to disk in between. + */ + public function commitTransaction() : void { try { - $this->GetConfig(); - $closure($this); $this->WriteConfig(); } finally { $this->noWrite = false; @@ -419,13 +424,14 @@ class ConfigurationManager } } - $this->setMultiple(function (ConfigurationManager $confManager) use ($domain) { - // Write domain - // Don't set the domain via the attribute, or we create a loop. - $confManager->set('domain', $domain); - // Reset the borg restore password when setting the domain - $confManager->borg_restore_password = ''; - }); + $this->startTransaction(); + // Write domain + // Don't set the domain via the attribute, or we create a loop. + $this->set('domain', $domain); + // Reset the borg restore password when setting the domain + $this->borg_restore_password = ''; + $this->startTransaction(); + $this->commitTransaction(); } public function GetBaseDN() : string { @@ -441,10 +447,10 @@ class ConfigurationManager */ public function SetBorgLocationVars(string $location, string $repo) : void { $this->ValidateBorgLocationVars($location, $repo); - $this->setMultiple(function (ConfigurationManager $confManager) use ($location, $repo) { - $confManager->borg_backup_host_location = $location; - $confManager->borg_remote_repo = $repo; - }); + $this->startTransaction(); + $this->borg_backup_host_location = $location; + $this->borg_remote_repo = $repo; + $this->commitTransaction(); } private function ValidateBorgLocationVars(string $location, string $repo) : void { @@ -490,10 +496,10 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables - $this->setMultiple(function (ConfigurationManager $confManager) { - $confManager->borg_backup_host_location = ''; - $confManager->borg_remote_repo = ''; - }); + $this->startTransaction(); + $this->borg_backup_host_location = ''; + $this->borg_remote_repo = ''; + $this->commitTransaction(); // Also delete the borg config file to be able to start over if (file_exists(DataConst::GetBackupKeyFile())) { @@ -513,12 +519,12 @@ class ConfigurationManager throw new InvalidSettingConfigurationException("Please enter the password!"); } - $this->setMultiple(function (ConfigurationManager $confManager) use ($location, $repo, $password) { - $confManager->borg_backup_host_location = $location; - $confManager->borg_remote_repo = $repo; - $confManager->borg_restore_password = $password; - $confManager->instance_restore_attempt = true; - }); + $this->startTransaction(); + $this->borg_backup_host_location = $location; + $this->borg_remote_repo = $repo; + $this->borg_restore_password = $password; + $this->instance_restore_attempt = true; + $this->commitTransaction(); } /** @@ -976,25 +982,25 @@ class ConfigurationManager if ($input === []) { return; } - $this->setMultiple(function(ConfigurationManager $confManager) use ($input) { - foreach ($input as $variable) { - if (!is_string($variable) || !str_contains($variable, '=')) { - error_log("Invalid input: '$variable' is not a string or does not contain an equal sign ('=')"); - continue; - } - $keyWithValue = $confManager->replaceEnvPlaceholders($variable); - // Pad the result with nulls so psalm is happy (and we don't risk to run into warnings in case - // the check for an equal sign from above gets changed). - [$key, $value] = explode('=', $keyWithValue, 2) + [null, null]; - if ($value === null) { - error_log("Invalid input: '$keyWithValue' has no value after the equal sign"); - } else if (!property_exists($confManager, $key)) { - error_log("Error: '$key' is not a valid configuration key (in '$keyWithValue')"); - } else { - $confManager->$key = $value; - } + $this->startTransaction(); + foreach ($input as $variable) { + if (!is_string($variable) || !str_contains($variable, '=')) { + error_log("Invalid input: '$variable' is not a string or does not contain an equal sign ('=')"); + continue; } - }); + $keyWithValue = $confManager->replaceEnvPlaceholders($variable); + // Pad the result with nulls so psalm is happy (and we don't risk to run into warnings in case + // the check for an equal sign from above gets changed). + [$key, $value] = explode('=', $keyWithValue, 2) + [null, null]; + if ($value === null) { + error_log("Invalid input: '$keyWithValue' has no value after the equal sign"); + } else if (!property_exists($confManager, $key)) { + error_log("Error: '$key' is not a valid configuration key (in '$keyWithValue')"); + } else { + $confManager->$key = $value; + } + } + $this->commitTransaction(); } // From dac5cfd917b8d7f7b748facf20874679e886cb36 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 16:43:41 +0100 Subject: [PATCH 49/92] Don't write the default value to disk This matches the previous behaviour and should not be changed silently. Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 1 - 1 file changed, 1 deletion(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2caf7849..d25e4a91 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -591,7 +591,6 @@ class ConfigurationManager $configValue = $this->get($configName, ''); if ($envVariableOutput === false) { if ($configValue === '') { - $this->set($configName, $defaultValue); return $defaultValue; } return $configValue; From 3bb2ce6e4cc979dc772c410e9ac568ed515f1271 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 16:55:15 +0100 Subject: [PATCH 50/92] Type-cast get values to fix handling old config data Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 36 ++++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d25e4a91..b7916b16 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -24,17 +24,20 @@ class ConfigurationManager } public bool $isDockerSocketProxyEnabled { - get => $this->get('isDockerSocketProxyEnabled', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isDockerSocketProxyEnabled', false); set { $this->set('isDockerSocketProxyEnabled', $value); } } public bool $isWhiteboardEnabled { - get => $this->get('isWhiteboardEnabled', true); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isWhiteboardEnabled', true); set { $this->set('isWhiteboardEnabled', $value); } } public bool $restoreExcludePreviews { - get => $this->get('restore-exclude-previews', false); + // Type-cast because old configs could have '1'/'' for this key. + get => (bool) $this->get('restore-exclude-previews', false); set { $this->set('restore-exclude-previews', $value); } } @@ -49,7 +52,8 @@ class ConfigurationManager } public bool $instance_restore_attempt { - get => $this->get('instance_restore_attempt', false); + // Type-cast because old configs could have 1/'' for this key. + get => (bool) $this->get('instance_restore_attempt', false); set { $this->set('instance_restore_attempt', $value); } } @@ -59,7 +63,8 @@ class ConfigurationManager } public bool $wasStartButtonClicked { - get => $this->get('wasStartButtonClicked', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('wasStartButtonClicked', false); set { $this->set('wasStartButtonClicked', $value); } } @@ -69,37 +74,44 @@ class ConfigurationManager } public bool $isClamavEnabled { - get => $this->get('isClamavEnabled', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isClamavEnabled', false); set { $this->set('isClamavEnabled', $value); } } public bool $isOnlyofficeEnabled { - get => $this->get('isOnlyofficeEnabled', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isOnlyofficeEnabled', false); set { $this->set('isOnlyofficeEnabled', $value); } } public bool $isCollaboraEnabled { - get => $this->get('isCollaboraEnabled', true); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isCollaboraEnabled', true); set { $this->set('isCollaboraEnabled', $value); } } public bool $isTalkEnabled { - get => $this->get('isTalkEnabled', true); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isTalkEnabled', true); set { $this->set('isTalkEnabled', $value); } } public bool $isTalkRecordingEnabled { - get => $this->isTalkEnabled && $this->get('isTalkRecordingEnabled', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->isTalkEnabled && $this->get('isTalkRecordingEnabled', false); set { $this->set('isTalkRecordingEnabled', $this->isTalkEnabled && $value); } } public bool $isImaginaryEnabled { - get => $this->get('isImaginaryEnabled', true); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $this->get('isImaginaryEnabled', true); set { $this->set('isImaginaryEnabled', $value); } } public bool $isFulltextsearchEnabled { - get => $this->get('isFulltextsearchEnabled', false); + // Type-cast because old configs could have 1/0 for this key. + get => (bool) $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)); } } From 27fd1e82ab74ffa7acf74eefae7b26f1ec7d8724 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:10:21 +0100 Subject: [PATCH 51/92] Turn install_latest_major property into a string so we can save a version string or number I chose a string instead of an integer so we have more freedom what to actually save (maybe we want to include minor version digits at one point). Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 8 +++++++- php/src/Data/ConfigurationManager.php | 7 ++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 7078b71f..47c6c259 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -177,8 +177,14 @@ readonly class DockerController { $port = 443; } + if (isset($request->getParsedBody()['install_latest_major'])) { + $install_latest_major = '32'; + } else { + $install_latest_major = ''; + } + $this->configurationManager->startTransaction(); - $this->configurationManager->install_latest_major = isset($request->getParsedBody()['install_latest_major']); + $this->configurationManager->install_latest_major = $install_latest_major; // set AIO_URL $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; // set wasStartButtonClicked diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b7916b16..7ca0f8bc 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -68,8 +68,9 @@ class ConfigurationManager set { $this->set('wasStartButtonClicked', $value); } } - public bool $install_latest_major { - get => $this->get('install_latest_major', false); + public string $install_latest_major { + // Type-cast because old configs could have integers for this key. + get => (string) $this->get('install_latest_major', ''); set { $this->set('install_latest_major', $value); } } @@ -1080,7 +1081,7 @@ class ConfigurationManager 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), 'NEXTCLOUD_ADDITIONAL_APKS' => $this->GetNextcloudAdditionalApks(), 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->GetNextcloudAdditionalPhpExtensions(), - 'INSTALL_LATEST_MAJOR' => $this->install_latest_major ? 'yes' : '', + 'INSTALL_LATEST_MAJOR' => $this->install_latest_major, 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), From dd5d51cb2a1ef50944e161f2c9e5b4f02808d926 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:12:45 +0100 Subject: [PATCH 52/92] Camelize property AIO_TOKEN => aioToken Signed-off-by: Pablo Zmdl --- php/src/Auth/AuthManager.php | 2 +- php/src/Controller/DockerController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/src/Auth/AuthManager.php b/php/src/Auth/AuthManager.php index 1d558aed..f6ab0d10 100644 --- a/php/src/Auth/AuthManager.php +++ b/php/src/Auth/AuthManager.php @@ -19,7 +19,7 @@ readonly class AuthManager { } public function CheckToken(string $token) : bool { - return hash_equals($this->configurationManager->AIO_TOKEN, $token); + return hash_equals($this->configurationManager->aioToken, $token); } public function SetAuthState(bool $isLoggedIn) : void { diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 47c6c259..862665c3 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -208,7 +208,7 @@ readonly class DockerController { } public function startTopContainer(bool $pullImage) : void { - $this->configurationManager->AIO_TOKEN = bin2hex(random_bytes(24)); + $this->configurationManager->aioToken = bin2hex(random_bytes(24)); // Stop domaincheck since apache would not be able to start otherwise $this->StopDomaincheckContainer(); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 7ca0f8bc..340e59d9 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -13,7 +13,7 @@ class ConfigurationManager private bool $noWrite = false; - public string $AIO_TOKEN { + public string $aioToken { get => $this->get('AIO_TOKEN', ''); set { $this->set('AIO_TOKEN', $value); } } @@ -1045,7 +1045,7 @@ class ConfigurationManager return match ($placeholder) { 'NC_DOMAIN' => $this->domain, 'NC_BASE_DN' => $this->GetBaseDN(), - 'AIO_TOKEN' => $this->AIO_TOKEN, + 'AIO_TOKEN' => $this->aioToken, 'BORGBACKUP_REMOTE_REPO' => $this->borg_remote_repo, 'BORGBACKUP_MODE' => $this->backupMode, 'AIO_URL' => $this->AIO_URL, From 62a21dd34a1bf8f9c346d92c585c8653b37c9a4d Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:16:02 +0100 Subject: [PATCH 53/92] Camelize property instance_restore_attempt => instanceRestoreAttempt Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/DockerController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index d4f4799f..7037946a 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -103,7 +103,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'has_backup_run_once' => $configurationManager->hasBackupRunOnce(), 'is_backup_container_running' => $dockerActionManager->isBackupContainerRunning(), 'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(), - 'is_instance_restore_attempt' => $configurationManager->instance_restore_attempt, + 'is_instance_restore_attempt' => $configurationManager->instanceRestoreAttempt, 'borg_backup_mode' => $configurationManager->backupMode, 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked, 'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(), diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 862665c3..c420bba3 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -154,7 +154,7 @@ readonly class DockerController { public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response { $this->configurationManager->startTransaction(); $this->configurationManager->backupMode = 'test'; - $this->configurationManager->instance_restore_attempt = false; + $this->configurationManager->instanceRestoreAttempt = false; $this->configurationManager->commitTransaction(); $id = self::TOP_CONTAINER; diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 340e59d9..94e8ae71 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -51,7 +51,7 @@ class ConfigurationManager set { $this->set('backup-mode', $value); } } - public bool $instance_restore_attempt { + public bool $instanceRestoreAttempt { // Type-cast because old configs could have 1/'' for this key. get => (bool) $this->get('instance_restore_attempt', false); set { $this->set('instance_restore_attempt', $value); } @@ -536,7 +536,7 @@ class ConfigurationManager $this->borg_backup_host_location = $location; $this->borg_remote_repo = $repo; $this->borg_restore_password = $password; - $this->instance_restore_attempt = true; + $this->instanceRestoreAttempt = true; $this->commitTransaction(); } From 68f811b25f690af648d5c178238791d76b561719 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:17:54 +0100 Subject: [PATCH 54/92] Camelize property AIO_URL => aioUrl Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index c420bba3..2bff0295 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -186,7 +186,7 @@ readonly class DockerController { $this->configurationManager->startTransaction(); $this->configurationManager->install_latest_major = $install_latest_major; // set AIO_URL - $this->configurationManager->AIO_URL = $host . ':' . (string)$port . $path; + $this->configurationManager->aioUrl = $host . ':' . (string)$port . $path; // set wasStartButtonClicked $this->configurationManager->wasStartButtonClicked = true; $this->configurationManager->commitTransaction(); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 94e8ae71..eaf944af 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -57,7 +57,7 @@ class ConfigurationManager set { $this->set('instance_restore_attempt', $value); } } - public string $AIO_URL { + public string $aioUrl { get => $this->get('AIO_URL', ''); set { $this->set('AIO_URL', $value); } } @@ -1048,7 +1048,7 @@ class ConfigurationManager 'AIO_TOKEN' => $this->aioToken, 'BORGBACKUP_REMOTE_REPO' => $this->borg_remote_repo, 'BORGBACKUP_MODE' => $this->backupMode, - 'AIO_URL' => $this->AIO_URL, + 'AIO_URL' => $this->aioUrl, 'SELECTED_RESTORE_TIME' => $this->selectedRestoreTime, 'RESTORE_EXCLUDE_PREVIEWS' => $this->restoreExcludePreviews ? '1' : '', 'APACHE_PORT' => $this->apache_port, From 2425a0777234a341337af57c347094eebef7712e Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:19:10 +0100 Subject: [PATCH 55/92] Camelize property install_latest_major => installLatestMajor Signed-off-by: Pablo Zmdl --- php/src/Controller/DockerController.php | 6 +++--- php/src/Data/ConfigurationManager.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index 2bff0295..81b920d0 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -178,13 +178,13 @@ readonly class DockerController { } if (isset($request->getParsedBody()['install_latest_major'])) { - $install_latest_major = '32'; + $installLatestMajor = '32'; } else { - $install_latest_major = ''; + $installLatestMajor = ''; } $this->configurationManager->startTransaction(); - $this->configurationManager->install_latest_major = $install_latest_major; + $this->configurationManager->installLatestMajor = $installLatestMajor; // set AIO_URL $this->configurationManager->aioUrl = $host . ':' . (string)$port . $path; // set wasStartButtonClicked diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index eaf944af..5ccf4b88 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -68,7 +68,7 @@ class ConfigurationManager set { $this->set('wasStartButtonClicked', $value); } } - public string $install_latest_major { + public string $installLatestMajor { // Type-cast because old configs could have integers for this key. get => (string) $this->get('install_latest_major', ''); set { $this->set('install_latest_major', $value); } @@ -1081,7 +1081,7 @@ class ConfigurationManager 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), 'NEXTCLOUD_ADDITIONAL_APKS' => $this->GetNextcloudAdditionalApks(), 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->GetNextcloudAdditionalPhpExtensions(), - 'INSTALL_LATEST_MAJOR' => $this->install_latest_major, + 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor, 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), From 62856e78bbaee7584a9ad9e6a255e6ec33aed06a Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:21:07 +0100 Subject: [PATCH 56/92] Camelize property borg_backup_host_location => borgBackupHostLocation Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 7037946a..7e3a3842 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -93,7 +93,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ return $view->render($response, 'containers.twig', [ 'domain' => $configurationManager->domain, 'apache_port' => $configurationManager->apache_port, - 'borg_backup_host_location' => $configurationManager->borg_backup_host_location, + 'borg_backup_host_location' => $configurationManager->borgBackupHostLocation, 'borg_remote_repo' => $configurationManager->borg_remote_repo, 'borg_public_key' => $configurationManager->GetBorgPublicKey(), 'nextcloud_password' => $configurationManager->GetAndGenerateSecret('NEXTCLOUD_PASSWORD'), diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 22309da8..84cd4d89 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -113,7 +113,7 @@ readonly class ContainerDefinitionFetcher { if (isset($entry['volumes'])) { foreach ($entry['volumes'] as $value) { if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') { - $value['source'] = $this->configurationManager->borg_backup_host_location; + $value['source'] = $this->configurationManager->borgBackupHostLocation; if($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 5ccf4b88..e7e830cc 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -122,7 +122,7 @@ class ConfigurationManager set { $this->SetDomain($value); } } - public string $borg_backup_host_location { + public string $borgBackupHostLocation { get => $this->get('borg_backup_host_location', ''); set { $this->set('borg_backup_host_location', $value); } } @@ -461,7 +461,7 @@ class ConfigurationManager public function SetBorgLocationVars(string $location, string $repo) : void { $this->ValidateBorgLocationVars($location, $repo); $this->startTransaction(); - $this->borg_backup_host_location = $location; + $this->borgBackupHostLocation = $location; $this->borg_remote_repo = $repo; $this->commitTransaction(); } @@ -510,7 +510,7 @@ class ConfigurationManager public function DeleteBorgBackupLocationItems() : void { // Delete the variables $this->startTransaction(); - $this->borg_backup_host_location = ''; + $this->borgBackupHostLocation = ''; $this->borg_remote_repo = ''; $this->commitTransaction(); @@ -533,7 +533,7 @@ class ConfigurationManager } $this->startTransaction(); - $this->borg_backup_host_location = $location; + $this->borgBackupHostLocation = $location; $this->borg_remote_repo = $repo; $this->borg_restore_password = $password; $this->instanceRestoreAttempt = true; @@ -1075,7 +1075,7 @@ class ConfigurationManager 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', - 'BORGBACKUP_HOST_LOCATION' => $this->borg_backup_host_location, + 'BORGBACKUP_HOST_LOCATION' => $this->borgBackupHostLocation, 'APACHE_MAX_SIZE' => (string)($this->GetApacheMaxSize()), 'COLLABORA_SECCOMP_POLICY' => $this->GetCollaboraSeccompPolicy(), 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), From 284411c3695bf10c81d24bc8c16d36263578ce0c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:22:14 +0100 Subject: [PATCH 57/92] Camelize property borg_remote_repo => borgRemoteRepo Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 7e3a3842..eafa994b 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -94,7 +94,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'domain' => $configurationManager->domain, 'apache_port' => $configurationManager->apache_port, 'borg_backup_host_location' => $configurationManager->borgBackupHostLocation, - 'borg_remote_repo' => $configurationManager->borg_remote_repo, + 'borg_remote_repo' => $configurationManager->borgRemoteRepo, 'borg_public_key' => $configurationManager->GetBorgPublicKey(), 'nextcloud_password' => $configurationManager->GetAndGenerateSecret('NEXTCLOUD_PASSWORD'), 'containers' => (new \AIO\ContainerDefinitionFetcher($container->get(\AIO\Data\ConfigurationManager::class), $container))->FetchDefinition(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e7e830cc..08924d14 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -127,7 +127,7 @@ class ConfigurationManager set { $this->set('borg_backup_host_location', $value); } } - public string $borg_remote_repo { + public string $borgRemoteRepo { get => $this->get('borg_remote_repo', ''); set { $this->set('borg_remote_repo', $value); } } @@ -462,7 +462,7 @@ class ConfigurationManager $this->ValidateBorgLocationVars($location, $repo); $this->startTransaction(); $this->borgBackupHostLocation = $location; - $this->borg_remote_repo = $repo; + $this->borgRemoteRepo = $repo; $this->commitTransaction(); } @@ -511,7 +511,7 @@ class ConfigurationManager // Delete the variables $this->startTransaction(); $this->borgBackupHostLocation = ''; - $this->borg_remote_repo = ''; + $this->borgRemoteRepo = ''; $this->commitTransaction(); // Also delete the borg config file to be able to start over @@ -534,7 +534,7 @@ class ConfigurationManager $this->startTransaction(); $this->borgBackupHostLocation = $location; - $this->borg_remote_repo = $repo; + $this->borgRemoteRepo = $repo; $this->borg_restore_password = $password; $this->instanceRestoreAttempt = true; $this->commitTransaction(); @@ -1046,7 +1046,7 @@ class ConfigurationManager 'NC_DOMAIN' => $this->domain, 'NC_BASE_DN' => $this->GetBaseDN(), 'AIO_TOKEN' => $this->aioToken, - 'BORGBACKUP_REMOTE_REPO' => $this->borg_remote_repo, + 'BORGBACKUP_REMOTE_REPO' => $this->borgRemoteRepo, 'BORGBACKUP_MODE' => $this->backupMode, 'AIO_URL' => $this->aioUrl, 'SELECTED_RESTORE_TIME' => $this->selectedRestoreTime, From 5cac2dcf12531b9631f06ba321a203059f5bd44c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:23:21 +0100 Subject: [PATCH 58/92] Camelize property borg_restore_password => borgRestorePassword Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index eafa994b..5e8ddbb8 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -114,7 +114,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled, 'is_collabora_enabled' => $configurationManager->isCollaboraEnabled, 'is_talk_enabled' => $configurationManager->isTalkEnabled, - 'borg_restore_password' => $configurationManager->borg_restore_password, + 'borg_restore_password' => $configurationManager->borgRestorePassword, 'daily_backup_time' => $configurationManager->GetDailyBackupTime(), 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), 'timezone' => $configurationManager->timezone, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 08924d14..a2dd399d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -132,7 +132,7 @@ class ConfigurationManager set { $this->set('borg_remote_repo', $value); } } - public string $borg_restore_password { + public string $borgRestorePassword { get => $this->get('borg_restore_password', ''); set { $this->set('borg_restore_password', $value); } } @@ -442,7 +442,7 @@ class ConfigurationManager // Don't set the domain via the attribute, or we create a loop. $this->set('domain', $domain); // Reset the borg restore password when setting the domain - $this->borg_restore_password = ''; + $this->borgRestorePassword = ''; $this->startTransaction(); $this->commitTransaction(); } @@ -535,7 +535,7 @@ class ConfigurationManager $this->startTransaction(); $this->borgBackupHostLocation = $location; $this->borgRemoteRepo = $repo; - $this->borg_restore_password = $password; + $this->borgRestorePassword = $password; $this->instanceRestoreAttempt = true; $this->commitTransaction(); } @@ -1056,7 +1056,7 @@ class ConfigurationManager 'TALK_PORT' => $this->talk_port, 'TURN_DOMAIN' => $this->turn_domain, 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, - 'BACKUP_RESTORE_PASSWORD' => $this->borg_restore_password, + 'BACKUP_RESTORE_PASSWORD' => $this->borgRestorePassword, 'CLAMAV_ENABLED' => $this->isClamavEnabled ? 'yes' : '', 'TALK_RECORDING_ENABLED' => $this->isTalkRecordingEnabled ? 'yes' : '', 'ONLYOFFICE_ENABLED' => $this->isOnlyofficeEnabled ? 'yes' : '', From f17db4fac17b4051e24650b9fd1007ddaac3e6c5 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:25:14 +0100 Subject: [PATCH 59/92] Camelize property apache_ip_binding => apacheIpBinding Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 4 ++-- php/src/Docker/DockerActionManager.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index a2dd399d..e80073c3 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -137,7 +137,7 @@ class ConfigurationManager set { $this->set('borg_restore_password', $value); } } - public string $apache_ip_binding { + public string $apacheIpBinding { get => $this->GetEnvironmentalVariableOrConfig('APACHE_IP_BINDING', 'apache_ip_binding', ''); set { $this->set('apache_ip_binding', $value); } } @@ -1052,7 +1052,7 @@ class ConfigurationManager 'SELECTED_RESTORE_TIME' => $this->selectedRestoreTime, 'RESTORE_EXCLUDE_PREVIEWS' => $this->restoreExcludePreviews ? '1' : '', 'APACHE_PORT' => $this->apache_port, - 'APACHE_IP_BINDING' => $this->apache_ip_binding, + 'APACHE_IP_BINDING' => $this->apacheIpBinding, 'TALK_PORT' => $this->talk_port, 'TURN_DOMAIN' => $this->turn_domain, 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 832480c2..5ae45044 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -289,7 +289,7 @@ readonly class DockerActionManager { } $ipBinding = $value->ipBinding; if ($ipBinding === '%APACHE_IP_BINDING%') { - $ipBinding = $this->configurationManager->apache_ip_binding; + $ipBinding = $this->configurationManager->apacheIpBinding; // Do not expose if AIO is in internal network mode if ($ipBinding === '@INTERNAL') { continue; From 41c92b814fde85bc509a7c51849b3c79dbbd87b6 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:33:24 +0100 Subject: [PATCH 60/92] Camelize key names from aio_variables from container specs Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e80073c3..3eba45f5 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -989,6 +989,11 @@ class ConfigurationManager return true; } } + + private function camelize(string $input, string $delimiter = '_') : string { + return lcfirst(implode("", array_map('ucfirst', explode($delimiter, strtolower($input))))); + + } public function setAioVariables(array $input) : void { if ($input === []) { @@ -1004,6 +1009,7 @@ class ConfigurationManager // Pad the result with nulls so psalm is happy (and we don't risk to run into warnings in case // the check for an equal sign from above gets changed). [$key, $value] = explode('=', $keyWithValue, 2) + [null, null]; + $key = $this->camelize($key); if ($value === null) { error_log("Invalid input: '$keyWithValue' has no value after the equal sign"); } else if (!property_exists($confManager, $key)) { From efe8317446c5020c131e2b9a402439b1ccfab688 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:34:33 +0100 Subject: [PATCH 61/92] Camelize property nextcloud_max_time => nextcloudMaxTime Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 5e8ddbb8..a9758b24 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -130,7 +130,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_datadir' => $configurationManager->nextcloud_datadir_mount, 'nextcloud_mount' => $configurationManager->nextcloud_mount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, - 'nextcloud_max_time' => $configurationManager->nextcloud_max_time, + 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 3eba45f5..ff30751c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -652,7 +652,7 @@ class ConfigurationManager return $uploadLimit * 1024 * 1024 * 1024; } - public string $nextcloud_max_time { + public string $nextcloudMaxTime { get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MAX_TIME', 'nextcloud_max_time', '3600'); set { $this->set('nextcloud_max_time', $value); } } @@ -1076,7 +1076,7 @@ class ConfigurationManager 'DOCKER_SOCKET_PROXY_ENABLED' => $this->isDockerSocketProxyEnabled ? 'yes' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloud_upload_limit, 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloud_memory_limit, - 'NEXTCLOUD_MAX_TIME' => $this->nextcloud_max_time, + 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, 'BORG_RETENTION_POLICY' => $this->GetBorgRetentionPolicy(), 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), From 5373471ed8f5671f59010f3ed6f9b16ed79dba67 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:35:52 +0100 Subject: [PATCH 62/92] Camelize property collabora_dictionaries => collaboraDictionaries Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index a9758b24..3aded9d0 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -120,7 +120,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'timezone' => $configurationManager->timezone, 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), 'talk_port' => $configurationManager->talk_port, - 'collabora_dictionaries' => $configurationManager->collabora_dictionaries, + 'collabora_dictionaries' => $configurationManager->collaboraDictionaries, 'collabora_additional_options' => $configurationManager->collabora_additional_options, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index a1132981..27c83e11 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -117,7 +117,7 @@ readonly class ConfigurationController { if (isset($request->getParsedBody()['collabora_dictionaries'])) { $collaboraDictionaries = $request->getParsedBody()['collabora_dictionaries'] ?? ''; - $this->configurationManager->collabora_dictionaries = $collaboraDictionaries; + $this->configurationManager->collaboraDictionaries = $collaboraDictionaries; } if (isset($request->getParsedBody()['delete_collabora_additional_options'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index ff30751c..71238c4c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -157,7 +157,7 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException */ - public string $collabora_dictionaries { + public string $collaboraDictionaries { get => $this->get('collabora_dictionaries', ''); set { // This throws an exception if the validation fails. @@ -1070,7 +1070,7 @@ class ConfigurationManager 'TALK_ENABLED' => $this->isTalkEnabled ? 'yes' : '', 'UPDATE_NEXTCLOUD_APPS' => ($this->isDailyBackupRunning() && $this->areAutomaticUpdatesEnabled()) ? 'yes' : '', 'TIMEZONE' => $this->timezone === '' ? 'Etc/UTC' : $this->timezone, - 'COLLABORA_DICTIONARIES' => $this->collabora_dictionaries === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->collabora_dictionaries, + 'COLLABORA_DICTIONARIES' => $this->collaboraDictionaries === '' ? 'de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru' : $this->collaboraDictionaries, 'IMAGINARY_ENABLED' => $this->isImaginaryEnabled ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->isDockerSocketProxyEnabled ? 'yes' : '', From b49900150180786735ad66b0e35793f7e672cd5b Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:36:45 +0100 Subject: [PATCH 63/92] Camelize property collabora_additional_options => collaboraAdditionalOptions Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- php/src/Docker/DockerActionManager.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 3aded9d0..cf17e612 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -121,7 +121,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), 'talk_port' => $configurationManager->talk_port, 'collabora_dictionaries' => $configurationManager->collaboraDictionaries, - 'collabora_additional_options' => $configurationManager->collabora_additional_options, + 'collabora_additional_options' => $configurationManager->collaboraAdditionalOptions, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 27c83e11..c396a508 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -126,7 +126,7 @@ readonly class ConfigurationController { if (isset($request->getParsedBody()['collabora_additional_options'])) { $additionalCollaboraOptions = $request->getParsedBody()['collabora_additional_options'] ?? ''; - $this->configurationManager->collabora_additional_options = $additionalCollaboraOptions; + $this->configurationManager->collaboraAdditionalOptions = $additionalCollaboraOptions; } if (isset($request->getParsedBody()['delete_borg_backup_location_vars'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 71238c4c..1dcc147d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -169,7 +169,7 @@ class ConfigurationManager /** * @throws InvalidSettingConfigurationException */ - public string $collabora_additional_options { + public string $collaboraAdditionalOptions { get => $this->get('collabora_additional_options', ''); set { // This throws an exception if the validation fails. @@ -882,7 +882,7 @@ class ConfigurationManager } public function isCollaboraSubscriptionEnabled() : bool { - return str_contains($this->collabora_additional_options, '--o:support_key='); + return str_contains($this->collaboraAdditionalOptions, '--o:support_key='); } /** diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 5ae45044..9e52fb5b 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -419,8 +419,8 @@ readonly class DockerActionManager { } // Additional Collabora options - if ($this->configurationManager->collabora_additional_options !== '') { - $requestBody['Cmd'] = [$this->configurationManager->collabora_additional_options]; + if ($this->configurationManager->collaboraAdditionalOptions !== '') { + $requestBody['Cmd'] = [$this->configurationManager->collaboraAdditionalOptions]; } } From c4aa148bff296e87edf7ff810d3973dfc4690375 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:37:36 +0100 Subject: [PATCH 64/92] Camelize property aio_community_containers => aioCommunityContainers Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index cf17e612..fedd7c2e 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -138,7 +138,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, 'community_containers' => $configurationManager->listAvailableCommunityContainers(), - 'community_containers_enabled' => $configurationManager->aio_community_containers, + 'community_containers_enabled' => $configurationManager->aioCommunityContainers, 'bypass_container_update' => $bypass_container_update, ]); })->setName('profile'); diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 84cd4d89..2884aa32 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -41,7 +41,7 @@ readonly class ContainerDefinitionFetcher { $data = json_decode((string)file_get_contents(DataConst::GetContainersDefinitionPath()), true, 512, JSON_THROW_ON_ERROR); $additionalContainerNames = []; - foreach ($this->configurationManager->aio_community_containers as $communityContainer) { + foreach ($this->configurationManager->aioCommunityContainers as $communityContainer) { if ($communityContainer !== '') { $path = DataConst::GetCommunityContainersDirectory() . '/' . $communityContainer . '/' . $communityContainer . '.json'; $additionalData = json_decode((string)file_get_contents($path), true, 512, JSON_THROW_ON_ERROR); diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index c396a508..8bf193e0 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -108,7 +108,7 @@ readonly class ConfigurationController { $enabledCC[] = $item; } } - $this->configurationManager->aio_community_containers = $enabledCC; + $this->configurationManager->aioCommunityContainers = $enabledCC; } if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 1dcc147d..9dc6589f 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -178,7 +178,7 @@ class ConfigurationManager } } - public array $aio_community_containers { + public array $aioCommunityContainers { get => explode(' ', $this->get('aio_community_containers', '')); set { $this->set('aio_community_containers', implode(' ', $value)); } } @@ -1092,7 +1092,7 @@ class ConfigurationManager // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), // Allow to get local ip-address of caddy container and add it to trusted proxies automatically - 'CADDY_IP_ADDRESS' => in_array('caddy', $this->aio_community_containers, true) ? gethostbyname('nextcloud-aio-caddy') : '', + 'CADDY_IP_ADDRESS' => in_array('caddy', $this->aioCommunityContainers, true) ? gethostbyname('nextcloud-aio-caddy') : '', 'WHITEBOARD_ENABLED' => $this->isWhiteboardEnabled ? 'yes' : '', default => $this->GetRegisteredSecret($placeholder), }; From 00ce78d703c8f7824eb76ba510f0a4f6c83da2c7 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:38:20 +0100 Subject: [PATCH 65/92] Camelize property turn_domain => turnDomain Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 9dc6589f..bfdcd689 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -183,7 +183,7 @@ class ConfigurationManager set { $this->set('aio_community_containers', implode(' ', $value)); } } - public string $turn_domain { + public string $turnDomain { get => $this->get('turn_domain', ''); set { $this->set('turn_domain', $value); } } @@ -1060,7 +1060,7 @@ class ConfigurationManager 'APACHE_PORT' => $this->apache_port, 'APACHE_IP_BINDING' => $this->apacheIpBinding, 'TALK_PORT' => $this->talk_port, - 'TURN_DOMAIN' => $this->turn_domain, + 'TURN_DOMAIN' => $this->turnDomain, 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, 'BACKUP_RESTORE_PASSWORD' => $this->borgRestorePassword, 'CLAMAV_ENABLED' => $this->isClamavEnabled ? 'yes' : '', From 567f072ee061a91cef464d52c39d85a63e5455d4 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:39:17 +0100 Subject: [PATCH 66/92] Camelize property apache_port => apachePort Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 6 +++--- php/src/Docker/DockerActionManager.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index fedd7c2e..b7d07f6a 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -92,7 +92,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ return $view->render($response, 'containers.twig', [ 'domain' => $configurationManager->domain, - 'apache_port' => $configurationManager->apache_port, + 'apache_port' => $configurationManager->apachePort, 'borg_backup_host_location' => $configurationManager->borgBackupHostLocation, 'borg_remote_repo' => $configurationManager->borgRemoteRepo, 'borg_public_key' => $configurationManager->GetBorgPublicKey(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index bfdcd689..984943db 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -381,7 +381,7 @@ class ConfigurationManager } // Get the apache port - $port = $this->apache_port; + $port = $this->apachePort; if (!filter_var($dnsRecordIP, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { if ($port === '443') { @@ -568,7 +568,7 @@ class ConfigurationManager $this->set('password', $newPassword); } - public string $apache_port { + public string $apachePort { get => $this->GetEnvironmentalVariableOrConfig('APACHE_PORT', 'apache_port', '443'); set { $this->set('apache_port', $value); } } @@ -1057,7 +1057,7 @@ class ConfigurationManager 'AIO_URL' => $this->aioUrl, 'SELECTED_RESTORE_TIME' => $this->selectedRestoreTime, 'RESTORE_EXCLUDE_PREVIEWS' => $this->restoreExcludePreviews ? '1' : '', - 'APACHE_PORT' => $this->apache_port, + 'APACHE_PORT' => $this->apachePort, 'APACHE_IP_BINDING' => $this->apacheIpBinding, 'TALK_PORT' => $this->talk_port, 'TURN_DOMAIN' => $this->turnDomain, diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 9e52fb5b..d4eac6b7 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -115,7 +115,7 @@ readonly class DockerActionManager { $containerName = $container->identifier; $internalPort = $container->internalPorts; if ($internalPort === '%APACHE_PORT%') { - $internalPort = $this->configurationManager->apache_port; + $internalPort = $this->configurationManager->apachePort; } elseif ($internalPort === '%TALK_PORT%') { $internalPort = $this->configurationManager->talk_port; } @@ -253,7 +253,7 @@ readonly class DockerActionManager { $port = $value->port; $protocol = $value->protocol; if ($port === '%APACHE_PORT%') { - $port = $this->configurationManager->apache_port; + $port = $this->configurationManager->apachePort; // Do not expose udp if AIO is in reverse proxy mode if ($port !== '443' && $protocol === 'udp') { continue; @@ -275,7 +275,7 @@ readonly class DockerActionManager { $port = $value->port; $protocol = $value->protocol; if ($port === '%APACHE_PORT%') { - $port = $this->configurationManager->apache_port; + $port = $this->configurationManager->apachePort; // Do not expose udp if AIO is in reverse proxy mode if ($port !== '443' && $protocol === 'udp') { continue; From f7c5115c7015083f273eb3930e13518fb12b50f1 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:40:23 +0100 Subject: [PATCH 67/92] Camelize property talk_port => talkPort Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- php/src/Docker/DockerActionManager.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index b7d07f6a..16e2918e 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -119,7 +119,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), 'timezone' => $configurationManager->timezone, 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped($skip_domain_validation), - 'talk_port' => $configurationManager->talk_port, + 'talk_port' => $configurationManager->talkPort, 'collabora_dictionaries' => $configurationManager->collaboraDictionaries, 'collabora_additional_options' => $configurationManager->collaboraAdditionalOptions, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 984943db..d0c0020f 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -573,7 +573,7 @@ class ConfigurationManager set { $this->set('apache_port', $value); } } - public string $talk_port { + public string $talkPort { get => $this->GetEnvironmentalVariableOrConfig('TALK_PORT', 'talk_port', '3478'); set { $this->set('talk_port', $value); } } @@ -1059,7 +1059,7 @@ class ConfigurationManager 'RESTORE_EXCLUDE_PREVIEWS' => $this->restoreExcludePreviews ? '1' : '', 'APACHE_PORT' => $this->apachePort, 'APACHE_IP_BINDING' => $this->apacheIpBinding, - 'TALK_PORT' => $this->talk_port, + 'TALK_PORT' => $this->talkPort, 'TURN_DOMAIN' => $this->turnDomain, 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, 'BACKUP_RESTORE_PASSWORD' => $this->borgRestorePassword, diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index d4eac6b7..e66989ca 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -117,7 +117,7 @@ readonly class DockerActionManager { if ($internalPort === '%APACHE_PORT%') { $internalPort = $this->configurationManager->apachePort; } elseif ($internalPort === '%TALK_PORT%') { - $internalPort = $this->configurationManager->talk_port; + $internalPort = $this->configurationManager->talkPort; } if ($internalPort !== "" && $internalPort !== 'host') { @@ -259,7 +259,7 @@ readonly class DockerActionManager { continue; } } else if ($port === '%TALK_PORT%') { - $port = $this->configurationManager->talk_port; + $port = $this->configurationManager->talkPort; } $portWithProtocol = $port . '/' . $protocol; $exposedPorts[$portWithProtocol] = null; @@ -281,7 +281,7 @@ readonly class DockerActionManager { continue; } } else if ($port === '%TALK_PORT%') { - $port = $this->configurationManager->talk_port; + $port = $this->configurationManager->talkPort; // Skip publishing talk tcp port if it is set to 443 if ($port === '443' && $protocol === 'tcp') { continue; From f35a0b43679feceae4fee98876a7cf17c5eb2881 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:41:26 +0100 Subject: [PATCH 68/92] Camelize property nextcloud_mount => nextcloudMount Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 4 ++-- php/src/Data/ConfigurationManager.php | 4 ++-- php/src/Docker/DockerActionManager.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 16e2918e..6319f632 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -128,7 +128,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->nextcloud_datadir_mount, - 'nextcloud_mount' => $configurationManager->nextcloud_mount, + 'nextcloud_mount' => $configurationManager->nextcloudMount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 2884aa32..7ef6827f 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -119,7 +119,7 @@ readonly class ContainerDefinitionFetcher { } } if($value['source'] === '%NEXTCLOUD_MOUNT%') { - $value['source'] = $this->configurationManager->nextcloud_mount; + $value['source'] = $this->configurationManager->nextcloudMount; if($value['source'] === '') { continue; } @@ -140,7 +140,7 @@ readonly class ContainerDefinitionFetcher { } } if ($value['destination'] === '%NEXTCLOUD_MOUNT%') { - $value['destination'] = $this->configurationManager->nextcloud_mount; + $value['destination'] = $this->configurationManager->nextcloudMount; if($value['destination'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d0c0020f..d5ce251d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -626,7 +626,7 @@ class ConfigurationManager return trim((string)file_get_contents(DataConst::GetBackupPublicKey())); } - public string $nextcloud_mount { + public string $nextcloudMount { get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MOUNT', 'nextcloud_mount', ''); set { $this->set('nextcloud_mount', $value); } } @@ -1061,7 +1061,7 @@ class ConfigurationManager 'APACHE_IP_BINDING' => $this->apacheIpBinding, 'TALK_PORT' => $this->talkPort, 'TURN_DOMAIN' => $this->turnDomain, - 'NEXTCLOUD_MOUNT' => $this->nextcloud_mount, + 'NEXTCLOUD_MOUNT' => $this->nextcloudMount, 'BACKUP_RESTORE_PASSWORD' => $this->borgRestorePassword, 'CLAMAV_ENABLED' => $this->isClamavEnabled ? 'yes' : '', 'TALK_RECORDING_ENABLED' => $this->isTalkRecordingEnabled ? 'yes' : '', diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index e66989ca..12dd70ae 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -205,7 +205,7 @@ readonly class DockerActionManager { foreach ($container->volumes->GetVolumes() as $volume) { // // NEXTCLOUD_MOUNT gets added via bind-mount later on // if ($container->identifier === 'nextcloud-aio-nextcloud') { - // if ($volume->name === $this->configurationManager->nextcloud_mount) { + // if ($volume->name === $this->configurationManager->nextcloudMount) { // continue; // } // } From f5cf7903adfb4eec6e1906a86eb2aa7bdaad61d5 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:42:15 +0100 Subject: [PATCH 69/92] Camelize property nextcloud_datadir_mount => nextcloudDatadirMount Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 6319f632..0db30a1b 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -127,7 +127,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), - 'nextcloud_datadir' => $configurationManager->nextcloud_datadir_mount, + 'nextcloud_datadir' => $configurationManager->nextcloudDatadirMount, 'nextcloud_mount' => $configurationManager->nextcloudMount, 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 7ef6827f..3bbc37e2 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -124,7 +124,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value['source'] === '%NEXTCLOUD_DATADIR%') { - $value['source'] = $this->configurationManager->nextcloud_datadir_mount; + $value['source'] = $this->configurationManager->nextcloudDatadirMount; if ($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d5ce251d..d1701a39 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -487,8 +487,8 @@ class ConfigurationManager // Prevent backup to be contained in Nextcloud Datadir as this will delete the backup archive upon restore // See https://github.com/nextcloud/all-in-one/issues/6607 - if (str_starts_with($location . '/', rtrim($this->nextcloud_datadir_mount, '/') . '/')) { - throw new InvalidSettingConfigurationException("The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to " . $this->nextcloud_datadir_mount); + if (str_starts_with($location . '/', rtrim($this->nextcloudDatadirMount, '/') . '/')) { + throw new InvalidSettingConfigurationException("The path must not be a children of or equal to NEXTCLOUD_DATADIR, which is currently set to " . $this->nextcloudDatadirMount); } } else { @@ -632,7 +632,7 @@ class ConfigurationManager } - public string $nextcloud_datadir_mount { + public string $nextcloudDatadirMount { get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_DATADIR', 'nextcloud_datadir', 'nextcloud_aio_nextcloud_data'); set { $this->set('nextcloud_datadir_mount', $value); } } From bbf41cfdd37b29d54b76dff4d67efe1e3df54b74 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:42:50 +0100 Subject: [PATCH 70/92] Camelize property nextcloud_upload_limit => nextcloudUploadLimit Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 0db30a1b..209f1d6d 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -129,7 +129,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), 'nextcloud_datadir' => $configurationManager->nextcloudDatadirMount, 'nextcloud_mount' => $configurationManager->nextcloudMount, - 'nextcloud_upload_limit' => $configurationManager->nextcloud_upload_limit, + 'nextcloud_upload_limit' => $configurationManager->nextcloudUploadLimit, 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d1701a39..ce547bf8 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -637,7 +637,7 @@ class ConfigurationManager set { $this->set('nextcloud_datadir_mount', $value); } } - public string $nextcloud_upload_limit { + public string $nextcloudUploadLimit { get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_UPLOAD_LIMIT', 'nextcloud_upload_limit', '16G'); set { $this->set('nextcloud_upload_limit', $value); } } @@ -648,7 +648,7 @@ class ConfigurationManager } public function GetApacheMaxSize() : int { - $uploadLimit = (int)rtrim($this->nextcloud_upload_limit, 'G'); + $uploadLimit = (int)rtrim($this->nextcloudUploadLimit, 'G'); return $uploadLimit * 1024 * 1024 * 1024; } @@ -1074,7 +1074,7 @@ class ConfigurationManager 'IMAGINARY_ENABLED' => $this->isImaginaryEnabled ? 'yes' : '', 'FULLTEXTSEARCH_ENABLED' => $this->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->isDockerSocketProxyEnabled ? 'yes' : '', - 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloud_upload_limit, + 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloudUploadLimit, 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloud_memory_limit, 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, 'BORG_RETENTION_POLICY' => $this->GetBorgRetentionPolicy(), From 8b8f60f76bf5595c7ff606510d7f05213cf8a47d Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:43:22 +0100 Subject: [PATCH 71/92] Camelize property nextcloud_memory_limit => nextcloudMemoryLimit Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 209f1d6d..47c6bb7b 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -131,7 +131,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_mount' => $configurationManager->nextcloudMount, 'nextcloud_upload_limit' => $configurationManager->nextcloudUploadLimit, 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, - 'nextcloud_memory_limit' => $configurationManager->nextcloud_memory_limit, + 'nextcloud_memory_limit' => $configurationManager->nextcloudMemoryLimit, 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index ce547bf8..1530708a 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -642,7 +642,7 @@ class ConfigurationManager set { $this->set('nextcloud_upload_limit', $value); } } - public string $nextcloud_memory_limit { + public string $nextcloudMemoryLimit { get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MEMORY_LIMIT', 'nextcloud_memory_limit', '512M'); set { $this->set('nextcloud_memory_limit', $value); } } @@ -1075,7 +1075,7 @@ class ConfigurationManager 'FULLTEXTSEARCH_ENABLED' => $this->isFulltextsearchEnabled ? 'yes' : '', 'DOCKER_SOCKET_PROXY_ENABLED' => $this->isDockerSocketProxyEnabled ? 'yes' : '', 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloudUploadLimit, - 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloud_memory_limit, + 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloudMemoryLimit, 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, 'BORG_RETENTION_POLICY' => $this->GetBorgRetentionPolicy(), 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), From 0ed83c52588f9ebaffcce44a17365fb81b1ae9ff Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Fri, 23 Jan 2026 17:45:19 +0100 Subject: [PATCH 72/92] Move get-configurable-aio-variables.sh into php/ folder Signed-off-by: Pablo Zmdl --- .../get-configurable-aio-variables.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename get-configurable-aio-variables.sh => php/get-configurable-aio-variables.sh (100%) diff --git a/get-configurable-aio-variables.sh b/php/get-configurable-aio-variables.sh similarity index 100% rename from get-configurable-aio-variables.sh rename to php/get-configurable-aio-variables.sh From 365e1e34e4bc27fd2f8b4fd959e4cfb453cb4f08 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:06:53 +0100 Subject: [PATCH 73/92] Make 'borgRetentionPolicy' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 1530708a..ce3d321d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -657,11 +657,9 @@ class ConfigurationManager set { $this->set('nextcloud_max_time', $value); } } - public function GetBorgRetentionPolicy() : string { - $envVariableName = 'BORG_RETENTION_POLICY'; - $configName = 'borg_retention_policy'; - $defaultValue = '--keep-within=7d --keep-weekly=4 --keep-monthly=6'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $borgRetentionPolicy { + get => $this->GetEnvironmentalVariableOrConfig('BORG_RETENTION_POLICY', 'borg_retention_policy', '--keep-within=7d --keep-weekly=4 --keep-monthly=6'); + set { $this->set('borg_retention_policy', $value); } } public function GetFulltextsearchJavaOptions() : string { @@ -1077,7 +1075,7 @@ class ConfigurationManager 'NEXTCLOUD_UPLOAD_LIMIT' => $this->nextcloudUploadLimit, 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloudMemoryLimit, 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, - 'BORG_RETENTION_POLICY' => $this->GetBorgRetentionPolicy(), + 'BORG_RETENTION_POLICY' => $this->borgRetentionPolicy, 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', From bfa2b64674843ea14a6542a0078fbe8576776e25 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:07:53 +0100 Subject: [PATCH 74/92] Make 'fulltextsearchJavaOptions' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index ce3d321d..41097c8d 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -662,11 +662,9 @@ class ConfigurationManager set { $this->set('borg_retention_policy', $value); } } - public function GetFulltextsearchJavaOptions() : string { - $envVariableName = 'FULLTEXTSEARCH_JAVA_OPTIONS'; - $configName = 'fulltextsearch_java_options'; - $defaultValue = '-Xms512M -Xmx512M'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $fulltextsearchJavaOptions { + get => $this->GetEnvironmentalVariableOrConfig('FULLTEXTSEARCH_JAVA_OPTIONS', 'fulltextsearch_java_options', '-Xms512M -Xmx512M'); + set { $this->set('fulltextsearch_java_options', $value); } } public function GetDockerSocketPath() : string { @@ -1076,7 +1074,7 @@ class ConfigurationManager 'NEXTCLOUD_MEMORY_LIMIT' => $this->nextcloudMemoryLimit, 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, 'BORG_RETENTION_POLICY' => $this->borgRetentionPolicy, - 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->GetFulltextsearchJavaOptions(), + 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->fulltextsearchJavaOptions, 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', 'BORGBACKUP_HOST_LOCATION' => $this->borgBackupHostLocation, From 63245430efa417d88ea7c13ffea433ea9bb069fe Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:08:44 +0100 Subject: [PATCH 75/92] Make 'dockerSocketPath' an attribute Signed-off-by: Pablo Zmdl --- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 3bbc37e2..ead82363 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -129,7 +129,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value['source'] === '%WATCHTOWER_DOCKER_SOCKET_PATH%') { - $value['source'] = $this->configurationManager->GetDockerSocketPath(); + $value['source'] = $this->configurationManager->dockerSocketPath; if($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 41097c8d..090762ae 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -667,11 +667,9 @@ class ConfigurationManager set { $this->set('fulltextsearch_java_options', $value); } } - public function GetDockerSocketPath() : string { - $envVariableName = 'WATCHTOWER_DOCKER_SOCKET_PATH'; - $configName = 'docker_socket_path'; - $defaultValue = '/var/run/docker.sock'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $dockerSocketPath { + get => $this->GetEnvironmentalVariableOrConfig('WATCHTOWER_DOCKER_SOCKET_PATH', 'docker_socket_path', '/var/run/docker.sock'); + set { $this->set('docker_socket_path', $value); } } public function GetTrustedCacertsDir() : string { From 4ad8fcf2581f7d39b2dda9912cd4f89e511fd328 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:09:32 +0100 Subject: [PATCH 76/92] Make 'trustedCacertsDir' an attribute Signed-off-by: Pablo Zmdl --- php/src/ContainerDefinitionFetcher.php | 2 +- php/src/Data/ConfigurationManager.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index ead82363..831a7bc5 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -134,7 +134,7 @@ readonly class ContainerDefinitionFetcher { continue; } } elseif ($value['source'] === '%NEXTCLOUD_TRUSTED_CACERTS_DIR%') { - $value['source'] = $this->configurationManager->GetTrustedCacertsDir(); + $value['source'] = $this->configurationManager->trustedCacertsDir; if($value['source'] === '') { continue; } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 090762ae..63862c91 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -672,11 +672,9 @@ class ConfigurationManager set { $this->set('docker_socket_path', $value); } } - public function GetTrustedCacertsDir() : string { - $envVariableName = 'NEXTCLOUD_TRUSTED_CACERTS_DIR'; - $configName = 'trusted_cacerts_dir'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $trustedCacertsDir { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_TRUSTED_CACERTS_DIR', 'trusted_cacerts_dir', ''); + set { $this->set('trusted_cacerts_dir', $value); } } public function GetNextcloudAdditionalApks() : string { @@ -1073,7 +1071,7 @@ class ConfigurationManager 'NEXTCLOUD_MAX_TIME' => $this->nextcloudMaxTime, 'BORG_RETENTION_POLICY' => $this->borgRetentionPolicy, 'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->fulltextsearchJavaOptions, - 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->GetTrustedCacertsDir(), + 'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->trustedCacertsDir, 'ADDITIONAL_DIRECTORIES_BACKUP' => $this->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '', 'BORGBACKUP_HOST_LOCATION' => $this->borgBackupHostLocation, 'APACHE_MAX_SIZE' => (string)($this->GetApacheMaxSize()), From d50dc2db1de2a7fe741db56db2f8dc9f6ae7c62b Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:10:08 +0100 Subject: [PATCH 77/92] Make 'nextcloudAdditionalApks' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 63862c91..6e62be77 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -677,11 +677,9 @@ class ConfigurationManager set { $this->set('trusted_cacerts_dir', $value); } } - public function GetNextcloudAdditionalApks() : string { - $envVariableName = 'NEXTCLOUD_ADDITIONAL_APKS'; - $configName = 'nextcloud_additional_apks'; - $defaultValue = 'imagemagick'; - return trim($this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue)); + public string $nextcloudAdditionalApks { + get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_APKS', 'nextcloud_additional_apks', 'imagemagick')); + set { $this->set('nextcloud_addtional_apks', $value); } } public function GetNextcloudAdditionalPhpExtensions() : string { @@ -1077,7 +1075,7 @@ class ConfigurationManager 'APACHE_MAX_SIZE' => (string)($this->GetApacheMaxSize()), 'COLLABORA_SECCOMP_POLICY' => $this->GetCollaboraSeccompPolicy(), 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), - 'NEXTCLOUD_ADDITIONAL_APKS' => $this->GetNextcloudAdditionalApks(), + 'NEXTCLOUD_ADDITIONAL_APKS' => $this->nextcloudAdditionalApks, 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->GetNextcloudAdditionalPhpExtensions(), 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor, 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', From c3477a7eb206aff3653a036395c4591068e85e96 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:10:35 +0100 Subject: [PATCH 78/92] Make 'nextcloudAdditionalPhpExtensions' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 6e62be77..c3f32f02 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -682,11 +682,9 @@ class ConfigurationManager set { $this->set('nextcloud_addtional_apks', $value); } } - public function GetNextcloudAdditionalPhpExtensions() : string { - $envVariableName = 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS'; - $configName = 'nextcloud_additional_php_extensions'; - $defaultValue = 'imagick'; - return trim($this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue)); + public string $nextcloudAdditionalPhpExtensions { + get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS', 'nextcloud_additional_php_extensions', 'imagick')); + set { $this->set('nextcloud_additional_php_extensions', $value); } } public function GetCollaboraSeccompPolicy() : string { @@ -1076,7 +1074,7 @@ class ConfigurationManager 'COLLABORA_SECCOMP_POLICY' => $this->GetCollaboraSeccompPolicy(), 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), 'NEXTCLOUD_ADDITIONAL_APKS' => $this->nextcloudAdditionalApks, - 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->GetNextcloudAdditionalPhpExtensions(), + 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->nextcloudAdditionalPhpExtensions, 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor, 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) From 22a26268e07308af0419739a56e0ad1f7d5517f3 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:27:55 +0100 Subject: [PATCH 79/92] Helper to booleanize environment-or-config-values Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index c3f32f02..c35f7ff9 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -1085,4 +1085,8 @@ class ConfigurationManager default => $this->GetRegisteredSecret($placeholder), }; } + + private function booleanize(mixed $value) : bool { + return in_array($value, [true, 'true'], true); + } } From dc5dc0215c1d304dc45e621f124fe3e2960d5389 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:12:01 +0100 Subject: [PATCH 80/92] Make 'collaboraSeccompDisabled' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 16 +++++----------- php/src/Docker/DockerActionManager.php | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index c35f7ff9..8e316b19 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -114,7 +114,7 @@ class ConfigurationManager // Type-cast because old configs could have 1/0 for this key. get => (bool) $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)); } + set { $this->set('isFulltextsearchEnabled', ($this->collaboraSeccompDisabled && $value)); } } public string $domain { @@ -689,21 +689,15 @@ class ConfigurationManager public function GetCollaboraSeccompPolicy() : string { $defaultString = '--o:security.seccomp='; - if (!$this->isSeccompDisabled()) { + if (!$this->collaboraSeccompDisabled) { return $defaultString . 'true'; } return $defaultString . 'false'; } - private function GetCollaboraSeccompDisabledState() : string { - $envVariableName = 'COLLABORA_SECCOMP_DISABLED'; - $configName = 'collabora_seccomp_disabled'; - $defaultValue = 'false'; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); - } - - public function isSeccompDisabled() : bool { - return $this->GetCollaboraSeccompDisabledState() === 'true'; + public bool $collaboraSeccompDisabled { + get => booleanize($this->GetEnvironmentalVariableOrConfig('COLLABORA_SECCOMP_DISABLED', 'collabora_seccomp_disabled', '')); + set { $this->set('collabora_seccomp_disabled', $value); } } /** diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 12dd70ae..47522e23 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -412,7 +412,7 @@ readonly class DockerActionManager { // Special things for the collabora container which should not be exposed in the containers.json } elseif ($container->identifier === 'nextcloud-aio-collabora') { - if (!$this->configurationManager->isSeccompDisabled()) { + if (!$this->configurationManager->collaboraSeccompDisabled) { // Load reference seccomp profile for collabora $seccompProfile = (string)file_get_contents(DataConst::GetCollaboraSeccompProfilePath()); $requestBody['HostConfig']['SecurityOpt'] = ["label:disable", "seccomp=$seccompProfile"]; From 08438aff4259eee999c4f3e1c380190f024ec28d Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:12:41 +0100 Subject: [PATCH 81/92] Make 'apacheAdditionalNetwork' an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 8 +++----- php/src/Docker/DockerActionManager.php | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 8e316b19..d5a5e4f0 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -874,11 +874,9 @@ class ConfigurationManager $this->set('collabora_additional_options', ''); } - public function GetApacheAdditionalNetwork() : string { - $envVariableName = 'APACHE_ADDITIONAL_NETWORK'; - $configName = 'apache_additional_network'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public string $apacheAdditionalNetwork { + get => $this->GetEnvironmentalVariableOrConfig('APACHE_ADDITIONAL_NETWORK', 'apache_additional_network', ''); + set { $this->set('apache_additional_network', $value); } } private function GetDisableBackupSection() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 47522e23..fd6334c6 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -837,7 +837,7 @@ readonly class DockerActionManager { $this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, alias: $alias); if ($container->identifier === 'nextcloud-aio-apache' || $container->identifier === 'nextcloud-aio-domaincheck') { - $apacheAdditionalNetwork = $this->configurationManager->GetApacheAdditionalNetwork(); + $apacheAdditionalNetwork = $this->configurationManager->apacheAdditionalNetwork; if ($apacheAdditionalNetwork !== '') { $this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, $apacheAdditionalNetwork, false, $alias); } From 0cb79a387fe128b158f6d7e784b3f47ff5c083be Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:19:57 +0100 Subject: [PATCH 82/92] Make 'disableBackupSection' an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 47c6bb7b..07837125 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -123,7 +123,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'collabora_dictionaries' => $configurationManager->collaboraDictionaries, 'collabora_additional_options' => $configurationManager->collaboraAdditionalOptions, 'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(), - 'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(), + 'is_backup_section_enabled' => !$configurationManager->disableBackupSection, 'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled, 'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled, 'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(), diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d5a5e4f0..d1825552 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -879,19 +879,9 @@ class ConfigurationManager set { $this->set('apache_additional_network', $value); } } - private function GetDisableBackupSection() : string { - $envVariableName = 'AIO_DISABLE_BACKUP_SECTION'; - $configName = 'disable_backup_section'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); - } - - public function isBackupSectionEnabled() : bool { - if ($this->GetDisableBackupSection() === 'true') { - return false; - } else { - return true; - } + public bool $disableBackupSection { + get => booleanize($this->GetEnvironmentalVariableOrConfig('AIO_DISABLE_BACKUP_SECTION', 'disable_backup_section', '')); + set { $this->set('disable_backup_section', $value); } } public function listAvailableCommunityContainers() : array { From 5fc4951ba0d4ecfb56bf6f0cfe3c983cef89ad2c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:26:39 +0100 Subject: [PATCH 83/92] Make 'nextcloudEnableDriDevice' an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 16 +++------------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 07837125..519ec71a 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -132,7 +132,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_upload_limit' => $configurationManager->nextcloudUploadLimit, 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, 'nextcloud_memory_limit' => $configurationManager->nextcloudMemoryLimit, - 'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(), + 'is_dri_device_enabled' => $configurationManager->nextcloudEnableDriDevice, 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled, 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index d1825552..afbe9fbc 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -919,19 +919,9 @@ class ConfigurationManager return $cc; } - private function GetEnabledDriDevice() : string { - $envVariableName = 'NEXTCLOUD_ENABLE_DRI_DEVICE'; - $configName = 'nextcloud_enable_dri_device'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); - } - - public function isDriDeviceEnabled() : bool { - if ($this->GetEnabledDriDevice() === 'true') { - return true; - } else { - return false; - } + public bool $nextcloudEnableDriDevice{ + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); + set { $this->set('nextcloud_enable_dri_device', $value); } } private function GetEnabledNvidiaGpu() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index fd6334c6..31ad2371 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -307,7 +307,7 @@ readonly class DockerActionManager { $devices = []; foreach ($container->devices as $device) { - if ($device === '/dev/dri' && !$this->configurationManager->isDriDeviceEnabled()) { + if ($device === '/dev/dri' && !$this->configurationManager->nextcloudEnableDriDevice) { continue; } $devices[] = ["PathOnHost" => $device, "PathInContainer" => $device, "CgroupPermissions" => "rwm"]; From 5bdcfd67eb54aa14401a75bb54d92466c73896fe Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:27:31 +0100 Subject: [PATCH 84/92] Make 'enableNvidiaGpu' an attribute Signed-off-by: Pablo Zmdl --- php/public/index.php | 2 +- php/src/Data/ConfigurationManager.php | 14 ++++---------- php/src/Docker/DockerActionManager.php | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/php/public/index.php b/php/public/index.php index 519ec71a..1ec42949 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -133,7 +133,7 @@ $app->get('/containers', function (Request $request, Response $response, array $ 'nextcloud_max_time' => $configurationManager->nextcloudMaxTime, 'nextcloud_memory_limit' => $configurationManager->nextcloudMemoryLimit, 'is_dri_device_enabled' => $configurationManager->nextcloudEnableDriDevice, - 'is_nvidia_gpu_enabled' => $configurationManager->isNvidiaGpuEnabled(), + 'is_nvidia_gpu_enabled' => $configurationManager->enableNvidiaGpu, 'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled, 'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled, 'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index afbe9fbc..e03e2bfb 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -923,16 +923,10 @@ class ConfigurationManager get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); set { $this->set('nextcloud_enable_dri_device', $value); } } - - private function GetEnabledNvidiaGpu() : string { - $envVariableName = 'NEXTCLOUD_ENABLE_NVIDIA_GPU'; - $configName = 'enable_nvidia_gpu'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); - } - - public function isNvidiaGpuEnabled() : bool { - return $this->GetEnabledNvidiaGpu() === 'true'; + + public bool $enableNvidiaGpu { + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', '')); + set { $this->set('enable_nvidia_gpu', $value); } } private function GetKeepDisabledApps() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 31ad2371..509f4c28 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -317,7 +317,7 @@ readonly class DockerActionManager { $requestBody['HostConfig']['Devices'] = $devices; } - if ($container->enableNvidiaGpu && $this->configurationManager->isNvidiaGpuEnabled()) { + if ($container->enableNvidiaGpu && $this->configurationManager->enableNvidiaGpu) { $requestBody['HostConfig']['Runtime'] = 'nvidia'; $requestBody['HostConfig']['DeviceRequests'] = [ [ From 3cfe307a5cb7651cb0b54bb7db5f4fac28c64b7c Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:39:40 +0100 Subject: [PATCH 85/92] Make `nextcloudKeepDisabledApps` an attribute Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e03e2bfb..57071d91 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -929,21 +929,11 @@ class ConfigurationManager set { $this->set('enable_nvidia_gpu', $value); } } - private function GetKeepDisabledApps() : string { - $envVariableName = 'NEXTCLOUD_KEEP_DISABLED_APPS'; - $configName = 'nextcloud_keep_disabled_apps'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + public bool $nextcloudKeepDisabledApps { + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_KEEP_DISABLED_APPS', 'nextcloud_keep_disabled_apps', '')); + set { $this->set('nextcloud_keep_disabled_apps', $value); } } - public function shouldDisabledAppsGetRemoved() : bool { - if ($this->GetKeepDisabledApps() === 'true') { - return false; - } else { - return true; - } - } - private function camelize(string $input, string $delimiter = '_') : string { return lcfirst(implode("", array_map('ucfirst', explode($delimiter, strtolower($input))))); @@ -1042,7 +1032,7 @@ class ConfigurationManager 'NEXTCLOUD_ADDITIONAL_APKS' => $this->nextcloudAdditionalApks, 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->nextcloudAdditionalPhpExtensions, 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor, - 'REMOVE_DISABLED_APPS' => $this->shouldDisabledAppsGetRemoved() ? 'yes' : '', + 'REMOVE_DISABLED_APPS' => $this->nextcloudKeepDisabledApps ? '' : 'yes', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), // Allow to get local ip-address of caddy container and add it to trusted proxies automatically From 078f3caf8aa180ff74ad906652d11757823576f2 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 26 Jan 2026 10:48:33 +0100 Subject: [PATCH 86/92] Move all properties to the top of the file Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 201 +++++++++++++------------- 1 file changed, 100 insertions(+), 101 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 57071d91..19b0a7bb 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -188,6 +188,106 @@ class ConfigurationManager set { $this->set('turn_domain', $value); } } + public string $apachePort { + get => $this->GetEnvironmentalVariableOrConfig('APACHE_PORT', 'apache_port', '443'); + set { $this->set('apache_port', $value); } + } + + public string $talkPort { + get => $this->GetEnvironmentalVariableOrConfig('TALK_PORT', 'talk_port', '3478'); + set { $this->set('talk_port', $value); } + } + + public string $nextcloudMount { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MOUNT', 'nextcloud_mount', ''); + set { $this->set('nextcloud_mount', $value); } + } + + public string $nextcloudDatadirMount { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_DATADIR', 'nextcloud_datadir', 'nextcloud_aio_nextcloud_data'); + set { $this->set('nextcloud_datadir_mount', $value); } + } + + public string $nextcloudUploadLimit { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_UPLOAD_LIMIT', 'nextcloud_upload_limit', '16G'); + set { $this->set('nextcloud_upload_limit', $value); } + } + + public string $nextcloudMemoryLimit { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MEMORY_LIMIT', 'nextcloud_memory_limit', '512M'); + set { $this->set('nextcloud_memory_limit', $value); } + } + + public function GetApacheMaxSize() : int { + $uploadLimit = (int)rtrim($this->nextcloudUploadLimit, 'G'); + return $uploadLimit * 1024 * 1024 * 1024; + } + + public string $nextcloudMaxTime { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MAX_TIME', 'nextcloud_max_time', '3600'); + set { $this->set('nextcloud_max_time', $value); } + } + + public string $borgRetentionPolicy { + get => $this->GetEnvironmentalVariableOrConfig('BORG_RETENTION_POLICY', 'borg_retention_policy', '--keep-within=7d --keep-weekly=4 --keep-monthly=6'); + set { $this->set('borg_retention_policy', $value); } + } + + public string $fulltextsearchJavaOptions { + get => $this->GetEnvironmentalVariableOrConfig('FULLTEXTSEARCH_JAVA_OPTIONS', 'fulltextsearch_java_options', '-Xms512M -Xmx512M'); + set { $this->set('fulltextsearch_java_options', $value); } + } + + public string $dockerSocketPath { + get => $this->GetEnvironmentalVariableOrConfig('WATCHTOWER_DOCKER_SOCKET_PATH', 'docker_socket_path', '/var/run/docker.sock'); + set { $this->set('docker_socket_path', $value); } + } + + public string $trustedCacertsDir { + get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_TRUSTED_CACERTS_DIR', 'trusted_cacerts_dir', ''); + set { $this->set('trusted_cacerts_dir', $value); } + } + + public string $nextcloudAdditionalApks { + get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_APKS', 'nextcloud_additional_apks', 'imagemagick')); + set { $this->set('nextcloud_addtional_apks', $value); } + } + + public string $nextcloudAdditionalPhpExtensions { + get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS', 'nextcloud_additional_php_extensions', 'imagick')); + set { $this->set('nextcloud_additional_php_extensions', $value); } + } + + public bool $collaboraSeccompDisabled { + get => booleanize($this->GetEnvironmentalVariableOrConfig('COLLABORA_SECCOMP_DISABLED', 'collabora_seccomp_disabled', '')); + set { $this->set('collabora_seccomp_disabled', $value); } + } + + public string $apacheAdditionalNetwork { + get => $this->GetEnvironmentalVariableOrConfig('APACHE_ADDITIONAL_NETWORK', 'apache_additional_network', ''); + set { $this->set('apache_additional_network', $value); } + } + + public bool $disableBackupSection { + get => booleanize($this->GetEnvironmentalVariableOrConfig('AIO_DISABLE_BACKUP_SECTION', 'disable_backup_section', '')); + set { $this->set('disable_backup_section', $value); } + } + + public bool $nextcloudEnableDriDevice{ + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); + set { $this->set('nextcloud_enable_dri_device', $value); } + } + + public bool $enableNvidiaGpu { + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', '')); + set { $this->set('enable_nvidia_gpu', $value); } + } + + public bool $nextcloudKeepDisabledApps { + get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_KEEP_DISABLED_APPS', 'nextcloud_keep_disabled_apps', '')); + set { $this->set('nextcloud_keep_disabled_apps', $value); } + } + private function GetConfig() : array { if ($this->config === [] && file_exists(DataConst::GetConfigFile())) @@ -568,16 +668,6 @@ class ConfigurationManager $this->set('password', $newPassword); } - public string $apachePort { - get => $this->GetEnvironmentalVariableOrConfig('APACHE_PORT', 'apache_port', '443'); - set { $this->set('apache_port', $value); } - } - - public string $talkPort { - get => $this->GetEnvironmentalVariableOrConfig('TALK_PORT', 'talk_port', '3478'); - set { $this->set('talk_port', $value); } - } - /** * @throws InvalidSettingConfigurationException */ @@ -626,67 +716,6 @@ class ConfigurationManager return trim((string)file_get_contents(DataConst::GetBackupPublicKey())); } - public string $nextcloudMount { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MOUNT', 'nextcloud_mount', ''); - set { $this->set('nextcloud_mount', $value); } - } - - - public string $nextcloudDatadirMount { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_DATADIR', 'nextcloud_datadir', 'nextcloud_aio_nextcloud_data'); - set { $this->set('nextcloud_datadir_mount', $value); } - } - - public string $nextcloudUploadLimit { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_UPLOAD_LIMIT', 'nextcloud_upload_limit', '16G'); - set { $this->set('nextcloud_upload_limit', $value); } - } - - public string $nextcloudMemoryLimit { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MEMORY_LIMIT', 'nextcloud_memory_limit', '512M'); - set { $this->set('nextcloud_memory_limit', $value); } - } - - public function GetApacheMaxSize() : int { - $uploadLimit = (int)rtrim($this->nextcloudUploadLimit, 'G'); - return $uploadLimit * 1024 * 1024 * 1024; - } - - public string $nextcloudMaxTime { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_MAX_TIME', 'nextcloud_max_time', '3600'); - set { $this->set('nextcloud_max_time', $value); } - } - - public string $borgRetentionPolicy { - get => $this->GetEnvironmentalVariableOrConfig('BORG_RETENTION_POLICY', 'borg_retention_policy', '--keep-within=7d --keep-weekly=4 --keep-monthly=6'); - set { $this->set('borg_retention_policy', $value); } - } - - public string $fulltextsearchJavaOptions { - get => $this->GetEnvironmentalVariableOrConfig('FULLTEXTSEARCH_JAVA_OPTIONS', 'fulltextsearch_java_options', '-Xms512M -Xmx512M'); - set { $this->set('fulltextsearch_java_options', $value); } - } - - public string $dockerSocketPath { - get => $this->GetEnvironmentalVariableOrConfig('WATCHTOWER_DOCKER_SOCKET_PATH', 'docker_socket_path', '/var/run/docker.sock'); - set { $this->set('docker_socket_path', $value); } - } - - public string $trustedCacertsDir { - get => $this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_TRUSTED_CACERTS_DIR', 'trusted_cacerts_dir', ''); - set { $this->set('trusted_cacerts_dir', $value); } - } - - public string $nextcloudAdditionalApks { - get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_APKS', 'nextcloud_additional_apks', 'imagemagick')); - set { $this->set('nextcloud_addtional_apks', $value); } - } - - public string $nextcloudAdditionalPhpExtensions { - get => trim($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS', 'nextcloud_additional_php_extensions', 'imagick')); - set { $this->set('nextcloud_additional_php_extensions', $value); } - } - public function GetCollaboraSeccompPolicy() : string { $defaultString = '--o:security.seccomp='; if (!$this->collaboraSeccompDisabled) { @@ -695,11 +724,6 @@ class ConfigurationManager return $defaultString . 'false'; } - public bool $collaboraSeccompDisabled { - get => booleanize($this->GetEnvironmentalVariableOrConfig('COLLABORA_SECCOMP_DISABLED', 'collabora_seccomp_disabled', '')); - set { $this->set('collabora_seccomp_disabled', $value); } - } - /** * @throws InvalidSettingConfigurationException */ @@ -874,16 +898,6 @@ class ConfigurationManager $this->set('collabora_additional_options', ''); } - public string $apacheAdditionalNetwork { - get => $this->GetEnvironmentalVariableOrConfig('APACHE_ADDITIONAL_NETWORK', 'apache_additional_network', ''); - set { $this->set('apache_additional_network', $value); } - } - - public bool $disableBackupSection { - get => booleanize($this->GetEnvironmentalVariableOrConfig('AIO_DISABLE_BACKUP_SECTION', 'disable_backup_section', '')); - set { $this->set('disable_backup_section', $value); } - } - public function listAvailableCommunityContainers() : array { $cc = []; $dir = scandir(DataConst::GetCommunityContainersDirectory()); @@ -919,21 +933,6 @@ class ConfigurationManager return $cc; } - public bool $nextcloudEnableDriDevice{ - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); - set { $this->set('nextcloud_enable_dri_device', $value); } - } - - public bool $enableNvidiaGpu { - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', '')); - set { $this->set('enable_nvidia_gpu', $value); } - } - - public bool $nextcloudKeepDisabledApps { - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_KEEP_DISABLED_APPS', 'nextcloud_keep_disabled_apps', '')); - set { $this->set('nextcloud_keep_disabled_apps', $value); } - } - private function camelize(string $input, string $delimiter = '_') : string { return lcfirst(implode("", array_map('ucfirst', explode($delimiter, strtolower($input))))); From ec66b359e0d3aaa1324abc172df9645c07a89ba4 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 27 Jan 2026 10:52:20 +0100 Subject: [PATCH 87/92] Check arguments to camelize() for usefulness Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 19b0a7bb..06122839 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -934,6 +934,12 @@ class ConfigurationManager } private function camelize(string $input, string $delimiter = '_') : string { + if ($input === '') { + throw new InvalidSettingConfigurationException('input cannot be empty!'); + } + if ($delimiter === '') { + $delimiter = '_'; + } return lcfirst(implode("", array_map('ucfirst', explode($delimiter, strtolower($input))))); } From 659b1ca383c575d27fba77f1b0d9d1f4624a6281 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 27 Jan 2026 10:58:25 +0100 Subject: [PATCH 88/92] Fix calling booleanize Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 06122839..e592286c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -259,7 +259,7 @@ class ConfigurationManager } public bool $collaboraSeccompDisabled { - get => booleanize($this->GetEnvironmentalVariableOrConfig('COLLABORA_SECCOMP_DISABLED', 'collabora_seccomp_disabled', '')); + get => $this->booleanize($this->GetEnvironmentalVariableOrConfig('COLLABORA_SECCOMP_DISABLED', 'collabora_seccomp_disabled', '')); set { $this->set('collabora_seccomp_disabled', $value); } } @@ -269,22 +269,22 @@ class ConfigurationManager } public bool $disableBackupSection { - get => booleanize($this->GetEnvironmentalVariableOrConfig('AIO_DISABLE_BACKUP_SECTION', 'disable_backup_section', '')); + get => $this->booleanize($this->GetEnvironmentalVariableOrConfig('AIO_DISABLE_BACKUP_SECTION', 'disable_backup_section', '')); set { $this->set('disable_backup_section', $value); } } public bool $nextcloudEnableDriDevice{ - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); + get => $this->booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_DRI_DEVICE', 'nextcloud_enable_dri_device', '')); set { $this->set('nextcloud_enable_dri_device', $value); } } public bool $enableNvidiaGpu { - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', '')); + get => $this->booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', '')); set { $this->set('enable_nvidia_gpu', $value); } } public bool $nextcloudKeepDisabledApps { - get => booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_KEEP_DISABLED_APPS', 'nextcloud_keep_disabled_apps', '')); + get => $this->booleanize($this->GetEnvironmentalVariableOrConfig('NEXTCLOUD_KEEP_DISABLED_APPS', 'nextcloud_keep_disabled_apps', '')); set { $this->set('nextcloud_keep_disabled_apps', $value); } } From d9d4e3680f94ec14bb32ee534e019868ca7e8db7 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 27 Jan 2026 11:55:24 +0100 Subject: [PATCH 89/92] Fix residue from change to use start/commitTransaction() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e592286c..c8f09890 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -954,17 +954,17 @@ class ConfigurationManager error_log("Invalid input: '$variable' is not a string or does not contain an equal sign ('=')"); continue; } - $keyWithValue = $confManager->replaceEnvPlaceholders($variable); + $keyWithValue = $this->replaceEnvPlaceholders($variable); // Pad the result with nulls so psalm is happy (and we don't risk to run into warnings in case // the check for an equal sign from above gets changed). [$key, $value] = explode('=', $keyWithValue, 2) + [null, null]; $key = $this->camelize($key); if ($value === null) { error_log("Invalid input: '$keyWithValue' has no value after the equal sign"); - } else if (!property_exists($confManager, $key)) { + } else if (!property_exists($this, $key)) { error_log("Error: '$key' is not a valid configuration key (in '$keyWithValue')"); } else { - $confManager->$key = $value; + $this->$key = $value; } } $this->commitTransaction(); From 5b6e0f30a6de38e1ec281443d8b0ce1121fcc0ed Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 27 Jan 2026 12:04:55 +0100 Subject: [PATCH 90/92] Fix assignment of INSTALL_LATEST_MAJOR from env replacement Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index c8f09890..25263b50 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -1036,7 +1036,7 @@ class ConfigurationManager 'NEXTCLOUD_STARTUP_APPS' => $this->GetNextcloudStartupApps(), 'NEXTCLOUD_ADDITIONAL_APKS' => $this->nextcloudAdditionalApks, 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS' => $this->nextcloudAdditionalPhpExtensions, - 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor, + 'INSTALL_LATEST_MAJOR' => $this->installLatestMajor ? 'yes' : '', 'REMOVE_DISABLED_APPS' => $this->nextcloudKeepDisabledApps ? '' : 'yes', // Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then) 'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'), From 5ba678c0820e748bad54a6748ad65f693b5a40bd Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Wed, 28 Jan 2026 12:08:07 +0100 Subject: [PATCH 91/92] Non-functional addition to camelizing nextcloud_mount to nextcloudMount Signed-off-by: Pablo Zmdl --- php/src/Docker/DockerActionManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 509f4c28..db48dc2c 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -400,7 +400,7 @@ readonly class DockerActionManager { // // Special things for the nextcloud container which should not be exposed in the containers.json // } elseif ($container->identifier === 'nextcloud-aio-nextcloud') { // foreach ($container->volumes->GetVolumes() as $volume) { - // if ($volume->name !== $this->configurationManager->nextcloud_mount) { + // if ($volume->name !== $this->configurationManager->nextcloudMount) { // continue; // } // $mounts[] = ["Type" => "bind", "Source" => $volume->name, "Target" => $volume->mountPoint, "ReadOnly" => !$volume->isWritable, "BindOptions" => [ "Propagation" => "rshared"]]; From 27020e608de07b035ff53eb508a41e680b06db2c Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Wed, 28 Jan 2026 13:28:07 +0100 Subject: [PATCH 92/92] fix get-configurable-aio-variables.sh script Signed-off-by: Simon L. Signed-off-by: Simon L. --- php/get-configurable-aio-variables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/get-configurable-aio-variables.sh b/php/get-configurable-aio-variables.sh index 44536bd3..3093e1e0 100755 --- a/php/get-configurable-aio-variables.sh +++ b/php/get-configurable-aio-variables.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -awk '/^ public [^f][^u][^n]/ { sub(/\$/, "", $3); print $3 }' php/src/Data/ConfigurationManager.php | sort +awk '/^ public [^f][^u][^n]/ { sub(/\$/, "", $3); print $3 }' src/Data/ConfigurationManager.php | sort