From a1bb53a4008de61830fb5522654c9be34cfc13ad Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Mon, 19 Jan 2026 13:02:19 +0100 Subject: [PATCH] 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(),