Merge pull request #7244 from nextcloud/enh/6690/follow-up

adjust `DeleteBorgBackupLocationVars` to also delete the `borg.config` file
This commit is contained in:
Simon L. 2025-12-03 11:36:33 +01:00 committed by GitHub
commit be1199ace1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -159,7 +159,7 @@ readonly class ConfigurationController {
}
if (isset($request->getParsedBody()['delete_borg_backup_location_vars'])) {
$this->configurationManager->DeleteBorgBackupLocationVars();
$this->configurationManager->DeleteBorgBackupLocationItems();
}
return $response->withStatus(201)->withHeader('Location', '.');

View file

@ -512,11 +512,19 @@ class ConfigurationManager
}
}
public function DeleteBorgBackupLocationVars() : void {
public function DeleteBorgBackupLocationItems() : void {
// Delete the variables
$config = $this->GetConfig();
$config['borg_backup_host_location'] = '';
$config['borg_remote_repo'] = '';
$this->WriteConfig($config);
// Also delete the borg config file to be able to start over
if (file_exists(DataConst::GetBackupKeyFile())) {
if (unlink(DataConst::GetBackupKeyFile())) {
error_log('borg.config file deleted to be able to start over.');
}
}
}
/**