Skip to content

Commit

Permalink
On the web UI, reset the configuration and state when starting over t…
Browse files Browse the repository at this point in the history
…he funel
  • Loading branch information
Quetzacoalt91 committed Jan 10, 2025
1 parent 4b479df commit c7d4624
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions controllers/admin/self-managed/HomePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c7d4624

Please sign in to comment.