mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-05 05:17:57 +00:00
Make borg_backup_host_location an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
8c4b05d768
commit
6488498bad
4 changed files with 16 additions and 16 deletions
|
|
@ -109,6 +109,11 @@ class ConfigurationManager
|
|||
set { $this->SetDomain($value); }
|
||||
}
|
||||
|
||||
public string $borg_backup_host_location {
|
||||
get => $this->get('borg_backup_host_location', '');
|
||||
set { $this->set('borg_backup_host_location', $value); }
|
||||
}
|
||||
|
||||
public function GetConfig() : array
|
||||
{
|
||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||
|
|
@ -379,9 +384,11 @@ class ConfigurationManager
|
|||
$this->ValidateBorgLocationVars($location, $repo);
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = $location;
|
||||
$config['borg_remote_repo'] = $repo;
|
||||
$this->WriteConfig($config);
|
||||
$this->setMultiple(function ($confManager) use ($location) {
|
||||
$confManager->borg_backup_host_location = $location;
|
||||
});
|
||||
}
|
||||
|
||||
private function ValidateBorgLocationVars(string $location, string $repo) : void {
|
||||
|
|
@ -428,9 +435,11 @@ class ConfigurationManager
|
|||
public function DeleteBorgBackupLocationItems() : void {
|
||||
// Delete the variables
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = '';
|
||||
$config['borg_remote_repo'] = '';
|
||||
$this->WriteConfig($config);
|
||||
$this->setMultiple(function ($confManager) {
|
||||
$confManager->borg_backup_host_location = '';
|
||||
});
|
||||
|
||||
// Also delete the borg config file to be able to start over
|
||||
if (file_exists(DataConst::GetBackupKeyFile())) {
|
||||
|
|
@ -451,12 +460,12 @@ class ConfigurationManager
|
|||
}
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = $location;
|
||||
$config['borg_remote_repo'] = $repo;
|
||||
$config['borg_restore_password'] = $password;
|
||||
$this->WriteConfig($config);
|
||||
|
||||
$this->setMultiple(function ($confManager) {
|
||||
$this->setMultiple(function ($confManager) use ($location) {
|
||||
$confManager->borg_backup_host_location = $location;
|
||||
$confManager->instance_restore_attempt = true;
|
||||
});
|
||||
}
|
||||
|
|
@ -556,15 +565,6 @@ class ConfigurationManager
|
|||
return $envVariableOutput;
|
||||
}
|
||||
|
||||
public function GetBorgBackupHostLocation() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['borg_backup_host_location'])) {
|
||||
$config['borg_backup_host_location'] = '';
|
||||
}
|
||||
|
||||
return $config['borg_backup_host_location'];
|
||||
}
|
||||
|
||||
public function GetBorgRemoteRepo() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['borg_remote_repo'])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue