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

Align ignoring rules between copy and deletion of files + ignore native module only if they have they vendor/ folder #699

Merged
merged 4 commits into from
May 20, 2024

Conversation

Quetzacoalt91
Copy link
Member

@Quetzacoalt91 Quetzacoalt91 commented May 16, 2024

Questions Answers
Description? This fixes an issue where modules files are unexpectly removed. It plugs XML diff to the method removing files to ignore, so the same rules during the copy of files are applied.

This also changes the way native modules are ignored. If one of them has never been modified (meaning their composer is still the one provided by the core), its content will be upgraded during the process.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? Fixes PrestaShop/PrestaShop#36184
Sponsor company @PrestaShopCorp
How to test? * Basic upgrades from 8.1.0 to 8.1.6 must upgrade files (delete + copy) in the ps_googleanalytics module during "Upgrade files" step.
* Installation of 8.1.0, deletion and reinstallation of module ps_googleanalytics, then upgrade to PS 8.1.6 should not delete or copy the module contents during "Upgrade files" step.

Error currently found in the CI and fixed by this PR:

Fatal error: Uncaught Error: Class "PrestaShop\Module\Ps_Googleanalytics\Hooks\HookDisplayFooter" not found in /var/www/html/modules/ps_googleanalytics/ps_googleanalytics.php:132 Stack trace: #0 /var/www/html/classes/Hook.php(1043): Ps_Googleanalytics->hookDisplayBeforeBodyClosingTag(Array)

This is related to a module ps_googleanalytics provided in both packages 8.1.0 and 8.1.6. In PrestaShop releases, native module dependencies are merged in the core composer.
This can be confirmed by checking if a vendor/ folder is present in the module contents:
image

When installing PrestaShop 8.1.0 and upgrade immediately to 8.1.6, the new core dependencies are copied but:

  • Some files were deleted if they were not found in the new release
  • The new files of the module were not copied

These 2 issues are respectively fixed by each topic covered in the description.

@Quetzacoalt91 Quetzacoalt91 self-assigned this May 16, 2024
@Quetzacoalt91 Quetzacoalt91 changed the title Filter on xml diff Listing files to delete should rely of the same ignoring rules as the other steps May 16, 2024
…ched (= their autoloader is still the one present in the core)
@Quetzacoalt91 Quetzacoalt91 marked this pull request as ready for review May 17, 2024 10:00
@Quetzacoalt91 Quetzacoalt91 changed the title Listing files to delete should rely of the same ignoring rules as the other steps Align ignoring rules between copy and deletion of files + ignore native module only if they have they vendor/ folder May 17, 2024
@M0rgan01 M0rgan01 added this to the 5.0.2 milestone May 17, 2024
Copy link
Contributor

@ga-devfront ga-devfront left a comment

Choose a reason for hiding this comment

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

All looks good for me nice refacto and improvement but I have just a question about /vendor file

classes/UpgradeTools/FileFilter.php Show resolved Hide resolved
@AureRita AureRita self-assigned this May 20, 2024
Copy link

@AureRita AureRita left a comment

Choose a reason for hiding this comment

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

Hi @Quetzacoalt91

Thank you for your PR, I tested it and it seems to works.

Tested on :
1.7.8.11 to 8.1.6
8.0.5 to 8.1.6 ( you corrected this PR : PrestaShop/PrestaShop#36184 )
8.0.5 to 9.0.0 ( you corrected this PR : PrestaShop/PrestaShop#36153 )
8.1.5 to 8.1.16
8.1.5 to 9.0.0
8.1.6 to 9.0.0

Because the PR seems to works as expected, It's QA ✔️

Thank you

@Quetzacoalt91 Quetzacoalt91 merged commit 5ab5a02 into PrestaShop:dev May 20, 2024
29 checks passed
@Quetzacoalt91 Quetzacoalt91 deleted the filter-on-xml-diff branch May 20, 2024 15:51
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