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