BobRay / UpgradeMODX

A dashboard widget that detects upgrades and (optionally) installs them from within the MODX Manager
https://bobsguides.com/upgrade-modx-package.html
22 stars 14 forks source link

Add php version check during installation #84

Closed Ruslan-Aleev closed 1 year ago

Ruslan-Aleev commented 1 year ago

It's not nice to see that a manager crashes with an error, and it can't be fixed quickly.

php

And in general, it is doubtful to require a PHP version from a small component; PHP 8 is not yet relevant for all sites.

SnowCreative commented 1 year ago

Yes, just discovered that, too. The error shows up at the top of the widget, and trying to upgrade generates a popup javascript error, like:

Error requesting page /assets/components/upgrademodx/connector.php?action=downloadfiles&props%5Bugm_setup_url%5D=https%3A%2F%2F[domainname] (etc.)

I just auto-updated all my sites using SiteDash, so now I have to go and revert them all by hand!

BobRay commented 1 year ago

Could you guys be a little more specific. UGM itself does not require PHP 8. Is this an issue with Guzzle (which I was forced to upgrade due to a security issue)?

Ruslan-Aleev commented 1 year ago

@BobRay

Could you guys be a little more specific

The sequence of my actions. 1) We have a website on MODX 2.8.5, running on php version 7.4. 2) Using the package manager, I update UpgradeMODX to version 2.3.4-pl. 3) And that’s it, I go to the manager, but it doesn’t work with the error above.

As I understand it, the php version is checked in the file - /core/components/upgrademodx/vendor/composer/platform_check.php

BobRay commented 1 year ago

Thanks. I've verified that version 2.3.4 does not run on PHP 7.4.

I see the problem: symfony/deprecation-contracts requires Php 8. I'm not sure how to fix this. I upgraded symfony to get rid of a bunch of deprecation warnings.

Ruslan-Aleev commented 1 year ago

Thanks for the answer. Alternatively, you can specify php requirements in the installer that would block the installation of a new version of the component, and the user would decide for himself whether to change the php version or not; If the problem cannot be fixed.

p.s. Although I’m not sure that this will be useful for automatic updating through the SitiDash, for example.

BobRay commented 1 year ago

The problem is mostly solved, except for some spurious error messages in the console when you install or upgrade.

As a workaround, you can put this in the composer.json file:

"config": { "platform-check": false },

If there is already a config section, just add the middle line to it. I think that will makes things work, but I haven't tested it.

BobRay commented 1 year ago

Fixed in 2.3.5-pl -- released. Closing

SnowCreative commented 1 year ago

Works great, Bob. Thanks for the quick turnaround!

BobRay commented 1 year ago

Your welcome! Thanks for the feedback.