Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions php/src/Controller/DockerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,27 @@ public function startBackup(bool $forceStopNextcloud = false) : void {
}

public function StartBackupContainerCheck(Request $request, Response $response, array $args) : Response {
$this->checkBackup();
return $response->withStatus(201)->withHeader('Location', '.');
// Get streaming response start and closure
$nonbufResp = $this->startStreamingResponse($response);
$addToStreamingResponseBody = $this->getAddToStreamingResponseBody($nonbufResp);

$this->checkBackup($addToStreamingResponseBody);

// End streaming response
$this->finalizeStreamingResponse($nonbufResp);
return $nonbufResp;
}

public function StartBackupContainerList(Request $request, Response $response, array $args) : Response {
$this->listBackup();
return $response->withStatus(201)->withHeader('Location', '.');
}

public function checkBackup() : void {
public function checkBackup(?\Closure $addToStreamingResponseBody = null) : void {
$this->configurationManager->backupMode = 'check';

$id = 'nextcloud-aio-borgbackup';
$this->PerformRecursiveContainerStart($id);
$this->PerformRecursiveContainerStart($id, true, $addToStreamingResponseBody);
}

private function listBackup() : void {
Expand Down
4 changes: 2 additions & 2 deletions php/templates/containers.twig
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<p><span class="status success"></span> Last {{ borg_backup_mode }} successful! (<a href="log?id=nextcloud-aio-borgbackup" target="_blank">Logs</a>)</p>
{% if borg_backup_mode == 'test' %}
<p>Feel free to check the integrity of the backup archive below before starting the restore process in order to make ensure that the restore will work. This can take a long time though depending on the size of the backup archive and is thus not required.</p>
<form method="POST" action="api/docker/backup-check" class="xhr">
<form method="POST" action="api/docker/backup-check" target="overlay-log">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input type="submit" value="Check backup integrity"/>
Expand Down Expand Up @@ -484,7 +484,7 @@

<h3>Backup check</h3>
<p>Click on the button below to perform a backup integrity check. This is an option that verifies that your backup is intact. It shouldn't be needed in most situations.</p>
<form method="POST" action="api/docker/backup-check" class="xhr">
<form method="POST" action="api/docker/backup-check" target="overlay-log">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input type="submit" value="Check backup integrity" onclick="return confirm('Check backup integrity? Are you sure that you want to check the backup? This can take a long time depending on the size of your backup.')" />
Expand Down