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

Unify calls to list directory contents #695

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Quetzacoalt91
Copy link
Member

@Quetzacoalt91 Quetzacoalt91 commented Apr 26, 2024

Questions Answers
Description? They are several ways to list the content of a directory, and some issues were met. This PR adds tests and plugs all the calls to a same method.
Type? refacto
BC breaks? Nope
Deprecations? Nope
Fixed ticket? Need to find it
Sponsor company PrestaShopCorp
How to test? Copy of files during upgrades, backups and restores work the same as before.

To Do list

  • Ignore modules during upgrade Reverted
  • Remove duplicated method listing files in UpgradeFiles.php
  • Test generation of files list for a rollback
  • Test generation of files list for a backup

Known issues

  • These issues will be reported because the module is not copied anymore during upgrade
[INTERNAL] /var/www/html/modules/autoupgrade/vendor/composer/ClassLoader.php line 571 - include(/var/www/html/vendor/composer/../../modules/ps_distributionapiclient/ps_distributionapiclient.php): failed to open stream: No such file or directory
[INTERNAL] /var/www/html/modules/autoupgrade/vendor/composer/ClassLoader.php line 571 - include(): Failed opening '/var/www/html/vendor/composer/../../modules/ps_distributionapiclient/ps_distributionapiclient.php' for inclusion (include_path='/var/www/html/vendor/pear/pear_exception:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/archive_tar:.:/usr/local/lib/php')

This will be fixed when the upgrade of modules is improved. In the meantime ignoring the whole modules/ folder has been reverted.

Issue found with the current version

Capture d’écran du 2024-04-19 14-22-27

@Quetzacoalt91 Quetzacoalt91 marked this pull request as draft April 26, 2024 15:52
@Quetzacoalt91 Quetzacoalt91 self-assigned this Apr 26, 2024
@Hlavtox
Copy link
Contributor

Hlavtox commented Apr 26, 2024

Guys please make sure we don't reintroduce some issues previously fixed, like - #651 🙏

@Quetzacoalt91
Copy link
Member Author

Quetzacoalt91 commented Apr 29, 2024

Guys please make sure we don't reintroduce some issues previously fixed, like - #651 🙏

The test I'm adding is supposed to cover the case you are talking about in your link, even if we're talking about modules instead of install.
The file of expected files to upgrade has a modules folder we can find deep in the tree. The root modules folder has been ignored, but this one remains.

"\/admin-dev\/themes\/default\/scss\/modules",
"\/admin-dev\/themes\/default\/scss\/modules\/_colors.scss",
"\/admin-dev\/themes\/default\/scss\/modules\/_mixins.scss",
"\/admin-dev\/themes\/default\/scss\/modules\/_variables.scss",
"\/admin-dev\/themes\/default\/scss\/modules\/index.php",

There is another case that could be covered though, where the case can be different (i.e install vs Installer). I'll have a look at it too.

@Hlavtox
Copy link
Contributor

Hlavtox commented Apr 30, 2024

@Quetzacoalt91 Cool, good job!!! :-)

@Hlavtox
Copy link
Contributor

Hlavtox commented May 1, 2024

One idea @Quetzacoalt91, do you think it would be to use this opportunity to fix one annoying behavior? The current logic copies all of the native modules in the zip to the install. Maybe we could copy them only if the folder already exists?

cc @MatShir and @kpodemski

@Quetzacoalt91
Copy link
Member Author

One idea @Quetzacoalt91, do you think it would be to use this opportunity to fix one annoying behavior? The current logic copies all of the native modules in the zip to the install. Maybe we could copy them only if the folder already exists?

cc @MatShir and @kpodemski

There are a few improvement we'd like to add in the upgrade process, something a bit smarter when we deal about modules (i.e avoiding rollback while copying, check if a module is new in the new release vs a simple upgrade). This PR makes us ready to stop copying the modules folder once we have something ready to improve module management during an upgrade.

@Quetzacoalt91 Quetzacoalt91 marked this pull request as ready for review May 1, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for review
5 participants