From c7d4624b377e5642e4277693a49ff248d62caf2b Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Fri, 10 Jan 2025 17:06:31 +0000 Subject: [PATCH] On the web UI, reset the configuration and state when starting over the funel --- controllers/admin/self-managed/HomePageController.php | 3 +++ .../admin/self-managed/UpdatePageVersionChoiceController.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/admin/self-managed/HomePageController.php b/controllers/admin/self-managed/HomePageController.php index 343f1a24e..bc44ace68 100644 --- a/controllers/admin/self-managed/HomePageController.php +++ b/controllers/admin/self-managed/HomePageController.php @@ -28,6 +28,7 @@ namespace PrestaShop\Module\AutoUpgrade\Controller; use PrestaShop\Module\AutoUpgrade\AjaxResponseBuilder; +use PrestaShop\Module\AutoUpgrade\Parameters\UpgradeFileNames; use PrestaShop\Module\AutoUpgrade\Router\Routes; use Symfony\Component\HttpFoundation\JsonResponse; @@ -56,6 +57,7 @@ public function submit(): JsonResponse $routeChoice = $this->request->request->get(self::FORM_FIELDS['route_choice']); if ($routeChoice === self::FORM_OPTIONS['update_value']) { + $this->upgradeContainer->getFileStorage()->clean(UpgradeFileNames::UPDATE_CONFIG_FILENAME); return AjaxResponseBuilder::nextRouteResponse(Routes::UPDATE_PAGE_VERSION_CHOICE); } @@ -64,6 +66,7 @@ public function submit(): JsonResponse return AjaxResponseBuilder::errorResponse('You can\'t access this route because you have no backups.', 401); } + $this->upgradeContainer->getFileStorage()->clean(UpgradeFileNames::RESTORE_CONFIG_FILENAME); return AjaxResponseBuilder::nextRouteResponse(Routes::RESTORE_PAGE_BACKUP_SELECTION); } diff --git a/controllers/admin/self-managed/UpdatePageVersionChoiceController.php b/controllers/admin/self-managed/UpdatePageVersionChoiceController.php index 44cb86211..484ecbfab 100644 --- a/controllers/admin/self-managed/UpdatePageVersionChoiceController.php +++ b/controllers/admin/self-managed/UpdatePageVersionChoiceController.php @@ -201,7 +201,9 @@ public function save(): JsonResponse $config->merge($requestConfig); $configurationStorage->save($config); - $state = $this->upgradeContainer->getUpdateState()->setDestinationVersion($this->upgradeContainer->getUpgrader()->getDestinationVersion()); + $state = $this->upgradeContainer->getUpdateState() + ->setDestinationVersion($this->upgradeContainer->getUpgrader()->getDestinationVersion()) + ->setBackupCompleted(false); $state->save(); if ($channel !== null) {