PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
7.95k stars 4.77k forks source link

During an autoupgrade, there is an error during the update of modules. #34048

Open M0rgan01 opened 10 months ago

M0rgan01 commented 10 months ago

Prerequisites

Describe the bug and add attachments

During the autoupgrade phase, modules are upgraded multiple times:

However, the second phase lacks a checksum to determine if files need to be removed.

Exemple:

1 - Our prestashop version 1.7.4.4 contains the linklist module in version 2.1.5. 2 - We are upgrading to prestashop version 1.7.5.0, which contains the linklist module in version 2.1.5. 3 - We proceed to the "upgradeModules" step, which calls the API api.prestashop.com and updates the linklist module to version 3.2.0. 4 - The process unzips 3.2.0 onto 2.1.5, but without checksum, the deleted or moved files in 3.2.0 are not. 5 - In this example we have an error PHP Fatal error: Uncaught Error: Class 'PrestaShop\Module\LinkList\Presenter\LinkBlockPresenter' not found in /usr/src/myapp/modules/ps_linklist/ps_linklist.php:87, but there may be other side effects

The problem is the same if we update the module with the manager module.

Expected behavior

No errors during automatic update or module update

Steps to reproduce

  1. Go to BO -> module manager
  2. Install module autoupgrade
  3. Upgrade prestashop to the version 1.7.5.0

PrestaShop version(s) where the bug happened

1.7.4.4

PHP version(s) where the bug happened

7.2

If your bug is related to a module, specify its name and its version

ps_linklist

Your company or customer's name goes here (if applicable).

No response

matks commented 10 months ago

the deleted or moved files in 3.2.0 are not.

HUGE 😄

matks commented 10 months ago

So if I understand correctly:

Let's consider a module XYZ, which has 2 versions: version v1.1.0 and version v2.0.0

Between version v1.1.0 and v2.0.0, the file A has been moved from one location to another, the file B has been deleted.

What happens when we perform the upgrade of module XYZ from v1.1.0 to v2.0.0 ; using the API to download the v2.0.0 ZIP, is that

Obviously, the fact that moved files and deleted files remain can create big problems.

The upgrade core system solves the above problem using a list of checkshums to find what moved, what was added and what was deleted. The upgrade module system does not have this ability and the API does not provide any checksum list.

M0rgan01 commented 10 months ago

An example on the same module. Here the LinkBlock, LinkBlockPresenter and LinkBlockRepository files should have been deleted. Capture vidéo du 27-09-2023 15:46:18.webm

sallemiines commented 10 months ago

Hello @M0rgan01

I didn't manage to reproduce your issue , I'm blocked with this Error in the upgrade process

image

Is this related to your problem ? WDT ?

Please check and feedback ! Thank you !

florine2623 commented 9 months ago

Hello @M0rgan01 ,

I've tried installing my shop multiple times, wih multiple versions of PHP, but I always encounter an error.

Screenshot 2023-10-18 at 11 55 18

Maybe this can be tested by a dev ? WDYT ?

M0rgan01 commented 9 months ago

@florine2623 Hi ! I think this is another mistake. The subject of the ticket is easily testable with the video (https://github.com/PrestaShop/PrestaShop/assets/36233446/e387c406-35a6-4813-a9ca-799c44afbe54) that I posted above, which shows that there are residual files during a module upgrade. There will be no visible errors, but residual files may cause unwanted behavior.

ChronoBrake commented 8 months ago

same problem

AureRita commented 8 months ago

Hi @M0rgan01

Thank you for your details but currently when I check you video, I see that in your ps_linklist.php have constantly the correct version before and after the upgrade of your module. And don't understand the problem after. Can you give us what we should not have after the upgrade ?

Waiting for your feedback

AureRita commented 8 months ago

After further research, I reproduce your issue on prestahsop version 1.7.8.10 as you can see :

Untitled_ Nov 9, 2023 5_08 PM.webm

I'll add it to the backlog.

Waiting for your PR,

Thank you