Allow to reset the borg backup host location before initial backup was started

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-06-10 14:18:05 +02:00
parent 3396c83df4
commit 694a3f6356
3 changed files with 21 additions and 0 deletions

View file

@ -121,6 +121,10 @@ class ConfigurationController
$this->configurationManager->SetCollaboraDictionaries($collaboraDictionaries);
}
if (isset($request->getParsedBody()['delete_borg_backup_host_location'])) {
$this->configurationManager->DeleteBorgBackupHostLocation();
}
return $response->withStatus(201)->withHeader('Location', '/');
} catch (InvalidSettingConfigurationException $ex) {
$response->getBody()->write($ex->getMessage());

View file

@ -413,6 +413,12 @@ class ConfigurationManager
$this->WriteConfig($config);
}
public function DeleteBorgBackupHostLocation() : void {
$config = $this->GetConfig();
$config['borg_backup_host_location'] = '';
$this->WriteConfig($config);
}
/**
* @throws InvalidSettingConfigurationException
*/

View file

@ -420,6 +420,17 @@
<input class="button" type="submit" value="Create backup" onclick="return confirm('Create backup? Are you sure that you want to create a backup? This will stop all running containers and create the backup.')" />
</form>
{% if has_backup_run_once == false %}
<h3>Reset backup host location</h3>
If the configured backup host location <b>{{ borg_backup_host_location }}</b> is wrong, you can reset it by clicking on the button below.<br><br/>
<form method="POST" action="/api/configuration" class="xhr">
<input type="hidden" name="delete_borg_backup_host_location" value="yes"/>
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input class="button" type="submit" value="Reset backup location" />
</form>
{% endif %}
{% if has_backup_run_once == true %}
<h3>Backup check</h3>
Click on the button below to perform a backup integrity check. This is an option that verifies that your backup is intact but it should't be needed in most situtations.<br><br/>