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
33fb191dfc
commit
e4fe52f694
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(),
|
'has_backup_run_once' => $configurationManager->hasBackupRunOnce(),
|
||||||
'is_backup_container_running' => $dockerActionManager->isBackupContainerRunning(),
|
'is_backup_container_running' => $dockerActionManager->isBackupContainerRunning(),
|
||||||
'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(),
|
'backup_exit_code' => $dockerActionManager->GetBackupcontainerExitCode(),
|
||||||
'is_instance_restore_attempt' => $configurationManager->isInstanceRestoreAttempt(),
|
'is_instance_restore_attempt' => $configurationManager->instance_restore_attempt,
|
||||||
'borg_backup_mode' => $configurationManager->backupMode,
|
'borg_backup_mode' => $configurationManager->backupMode,
|
||||||
'was_start_button_clicked' => $configurationManager->wasStartButtonClicked,
|
'was_start_button_clicked' => $configurationManager->wasStartButtonClicked,
|
||||||
'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(),
|
'has_update_available' => $dockerActionManager->isAnyUpdateAvailable(),
|
||||||
|
|
|
||||||
|
|
@ -150,10 +150,8 @@ readonly class DockerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function StartBackupContainerTest(Request $request, Response $response, array $args) : Response {
|
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->backupMode = 'test';
|
||||||
|
$this->configurationManager->instance_restore_attempt = false;
|
||||||
|
|
||||||
$id = self::TOP_CONTAINER;
|
$id = self::TOP_CONTAINER;
|
||||||
$this->PerformRecursiveContainerStop($id);
|
$this->PerformRecursiveContainerStop($id);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ class ConfigurationManager
|
||||||
set { $this->set('backup-mode', $value); }
|
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 {
|
public string $AIO_URL {
|
||||||
get => $this->get('AIO_URL', '');
|
get => $this->get('AIO_URL', '');
|
||||||
set { $this->set('AIO_URL', $value); }
|
set { $this->set('AIO_URL', $value); }
|
||||||
|
|
@ -529,8 +534,11 @@ class ConfigurationManager
|
||||||
$config['borg_backup_host_location'] = $location;
|
$config['borg_backup_host_location'] = $location;
|
||||||
$config['borg_remote_repo'] = $repo;
|
$config['borg_remote_repo'] = $repo;
|
||||||
$config['borg_restore_password'] = $password;
|
$config['borg_restore_password'] = $password;
|
||||||
$config['instance_restore_attempt'] = 1;
|
|
||||||
$this->WriteConfig($config);
|
$this->WriteConfig($config);
|
||||||
|
|
||||||
|
$this->setMultiple(function ($confManager) {
|
||||||
|
$confManager->instance_restore_attempt = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -663,18 +671,6 @@ class ConfigurationManager
|
||||||
return $config['borg_restore_password'];
|
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 {
|
public function GetNextcloudMount() : string {
|
||||||
$envVariableName = 'NEXTCLOUD_MOUNT';
|
$envVariableName = 'NEXTCLOUD_MOUNT';
|
||||||
$configName = 'nextcloud_mount';
|
$configName = 'nextcloud_mount';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue