mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
Make backupMode an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
419eede1c0
commit
af76dbaeeb
3 changed files with 13 additions and 23 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue