Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lifecycle of state and configuration files #1117

Merged
merged 6 commits into from
Jan 20, 2025

Conversation

Quetzacoalt91
Copy link
Member

Questions Answers
Description? Make sure the state is only defined while a process is run (update / backup / restore) and rely on the configuration class for the rest of the module use.
Type? Refacto
BC breaks? Nope
Deprecations? Nope
Fixed ticket? /
Sponsor company @PrestaShopCorp
How to test?
  • Make a process fail : The next attempt must start from the beginning not where it stopped.
  • Starting over the update funel will reset the backup completion, displaying again the step asking for the merchant to backup its store.

@Quetzacoalt91 Quetzacoalt91 marked this pull request as ready for review January 14, 2025 15:57
classes/Upgrader.php Outdated Show resolved Hide resolved
@@ -88,7 +88,11 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int

$this->upgradeContainer->initPrestaShopAutoloader();
$this->upgradeContainer->initPrestaShopCore();
$this->upgradeContainer->getUpdateState()->initDefault($this->upgradeContainer->getProperty(UpgradeContainer::PS_VERSION), $this->upgradeContainer->getUpgrader()->getDestinationVersion());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the state for the check of requirements.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why ? The objective is to not have the state anymore outside the actual process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we go to the UpgradeSelfCheck class and look for occurrences of the state, we can see that this one is used.

The objective is to not have the state anymore outside the actual process

Can you define "process"? Isn't the requirements check a process in itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The process running the tasks is a part of the (update) funnel. By having the state outside the process applying changes on the store, we struggle to clean the previous context properly in case of error.

Thanks for the class, I'll have a look at it as well.

@Quetzacoalt91 Quetzacoalt91 force-pushed the reset-state-and-config branch 3 times, most recently from cc959e9 to f8c5489 Compare January 14, 2025 17:37
@Quetzacoalt91 Quetzacoalt91 force-pushed the reset-state-and-config branch 6 times, most recently from edbcce1 to f22cf1a Compare January 15, 2025 15:44
@Quetzacoalt91 Quetzacoalt91 changed the title Reset state and config Reset lifecycle of state and configuration files Jan 15, 2025
@Quetzacoalt91 Quetzacoalt91 changed the title Reset lifecycle of state and configuration files Update lifecycle of state and configuration files Jan 15, 2025
Copy link

@ga-devfront ga-devfront added this to the 7.0.0 milestone Jan 20, 2025
@paulnoelcholot paulnoelcholot self-assigned this Jan 20, 2025
@paulnoelcholot
Copy link

Hello @Quetzacoalt91,

I tested your PR and it's good for me ! 🎉

Thanks!

8.1.7 → 8.2
https://www.loom.com/share/1668d35efc9e4ae2aff15d4f1b00c989?sid=b3f0036a-49c8-47b0-a9fa-c34c1bd2bb62

image

@Quetzacoalt91 Quetzacoalt91 merged commit fe4bc6f into PrestaShop:dev Jan 20, 2025
37 checks passed
@Quetzacoalt91 Quetzacoalt91 deleted the reset-state-and-config branch January 20, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

5 participants