Make restoreExcludePreviews an attribute

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl 2026-01-19 13:02:19 +01:00
parent b8130958c5
commit c968e9e310
3 changed files with 7 additions and 16 deletions

View file

@ -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;

View file

@ -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
*/

View file

@ -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(),