From 6e87758ba962bd38afff97a0466e01255279131c Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Fri, 6 Mar 2026 10:40:45 +0100 Subject: [PATCH] DockerController: refactor `StartBackupContainerBackup` to show the stopping and starting state Signed-off-by: Simon L. --- php/src/Controller/DockerController.php | 17 ++++++++++++----- php/templates/containers.twig | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index acb0980c..33df1ef1 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -87,19 +87,26 @@ readonly class DockerController { } public function StartBackupContainerBackup(Request $request, Response $response, array $args) : Response { + // Get streaming response start and closure + $nonbufResp = $this->startStreamingResponse($response); + $addToStreamingResponseBody = $this->getAddToStreamingResponseBody($nonbufResp); + $forceStopNextcloud = true; - $this->startBackup($forceStopNextcloud); - return $response->withStatus(201)->withHeader('Location', '.'); + $this->startBackup($forceStopNextcloud, $addToStreamingResponseBody); + + // End streaming response + $this->finalizeStreamingResponse($nonbufResp); + return $nonbufResp; } - public function startBackup(bool $forceStopNextcloud = false) : void { + public function startBackup(bool $forceStopNextcloud = false, ?\Closure $addToStreamingResponseBody = null) : void { $this->configurationManager->backupMode = 'backup'; $id = self::TOP_CONTAINER; - $this->PerformRecursiveContainerStop($id, $forceStopNextcloud); + $this->PerformRecursiveContainerStop($id, $forceStopNextcloud, $addToStreamingResponseBody); $id = 'nextcloud-aio-borgbackup'; - $this->PerformRecursiveContainerStart($id); + $this->PerformRecursiveContainerStart($id, true, $addToStreamingResponseBody); } public function StartBackupContainerCheck(Request $request, Response $response, array $args) : Response { diff --git a/php/templates/containers.twig b/php/templates/containers.twig index b623010e..884628a3 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -472,7 +472,7 @@ {% if isApacheStarting != true %}

Backup creation

Clicking on the button below will create a backup.

-
+