-
Notifications
You must be signed in to change notification settings - Fork 80
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
Check WordPress and PHP requirements before installing a theme or plugin #436
Conversation
This matches the behavior of WordPress core which will refuse to install a plugin if the local copy of WordPress or PHP don't meet the minimum requirements for the most recent version as listed by the plugin authors. Unfortunately the api is limited and only provides these requirement details for the most recent version, so it isn't possible to find an older version that might work. As a compromise, this code doesn't check requirements if a user provides a specific --version since we can't know the requirements for anything other than the latest version and assume if somebody specifies a version they know it will work or want to try anyway.
The built in wp functions for this are too new (Added in 5.2)
Interesting, this now reveals issues with existing tests like:
When running the WordPress 3.7 test. Several similar errors in the WordPress 6.2 test as many of the plugins we use for the tests actually require newer versions of WordPress. If the PR seems OK otherwise I can fix those, either by finding new plugins or just by specifying a specific plugin version for those tests (which bypasses this new check). |
Similar to what would happen in is_wp_version_compatible()
Try and only test these with supported wp versions on unsupported php
WP 6.4 requires PHP 7+
Should we perhaps add an This will also be relevant for #407 (plugin dependencies). |
Per code review, also offer --ignore-requirements as a way to install themes and plugins that don't meet the listed requirements
Sounds good, I added that arg. The only thing left is what to do about failing tests on WP 3.7 and WP 6.2. They are all for the same reason that the plugins we use for these tests have a higher WP requirement and now |
The tests involving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
This matches the behavior of WordPress core which will refuse to install a plugin if the local copy of WordPress or PHP don't meet the minimum requirements for the most recent version as listed by the plugin authors.
Unfortunately the api is limited and only provides these requirement details for the most recent version, so it isn't possible to find an older version that might work. As a compromise, this code doesn't check requirements if a user provides a specific
--version
since we can't know the requirements for anything other than the latest version and assume if somebody specifies a version they know it will work or want to try anyway.