From 83de5260511dcfabc32cafaa576aa1fe611b0c56 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 2 Dec 2025 12:42:13 +0100 Subject: [PATCH] adjust DeleteBorgBackupLocationVars to also delete the borg.config file Signed-off-by: Simon L. --- php/src/Controller/ConfigurationController.php | 2 +- php/src/Data/ConfigurationManager.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php index 051f8d9e..45586f9c 100644 --- a/php/src/Controller/ConfigurationController.php +++ b/php/src/Controller/ConfigurationController.php @@ -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', '.'); diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 253b1371..e9982eb3 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -506,11 +506,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.'); + } + } } /**