-
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
Support requires and requires_php in plugin/theme list and update command #440
base: main
Are you sure you want to change the base?
Conversation
…mands This introduces a new update sate of 'unavailable' which is when there is a new version of a theme/plugin upstream but the local WordPress / PHP requirements do not meet the requirements set by the authors.
Thanks a lot for working on this! I haven't tested it yet, but it looks very promising already. It will be very useful for better managing updates when knowing that newer (albeit incompatible) versions are available. On that note, what do you think about renaming IMO |
Interesting, I picked
|
@wp-cli/committers @wp-cli/maintainers any preference here on the wording? Also generally a review here is appreciated :) |
This introduces a new update sate of 'unavailable' which is when there is a new version of a theme/plugin upstream but the local WordPress / PHP requirements do not meet the requirements set by the authors.
What this changes:
Changes the
update
field of an item from a bool which laters gets turned into 'available' or 'none' to a string which will be either'available'
,'none'
, or'unavailable'
. Newunavailable
is based off a check against WordPress and PHP requirements via therequires
andrequires_php
fields.This works similarly for PHP versions too:
This also fixes issues like #428 by removing incompatible updates from a command like:
This also adds the fields
requires
andrequires_php
. While these aren't default fields, I did change it so that it will include them by default if one of the plugins has an update sate of unavailable (so it is immediately clear why the update is unavailable).I've also written it so that
requires
andrequires_php
fields will use either what is provided for the latest version in the case of an update (unavailable or not) or whatever is listed in the current plugin file.This means that in the case of 'none' it i showing the requirements for the current version, while in the case of 'available' or 'unavailable' it is showing the requirements for the
update_version
. This could be a bit confusing, but it made even less sense the other way to have it list an update as 'unavailable' while showing the older and already met requirements from the currently installed version. Those were just my initial idea, so any feedback welcome there. Similar to the field names, etc...Finally, I couldn't find much documentation about the wordpress.org update API, but what I saw in testing is:
For plugins, the wordpress.org api will check the version of WordPress sent in the header of the request from wp core and if the latest upstream version requires a newer version of WordPress, it moves that plugin into the
no_update
section of the response, along with any other plugins that just don't have an update available. It doesn't know the current version of PHP, so it can't check that. The current situation is that if an upstream update requires a newer version of WordPress then WP CLI doesn't see it at all, because it doesn't look for it in theno_updates
section of the response. If it requires a newer version of PHP, WP CLI will show it as an available update because it doesn't know about the PHP incompatibility.For themes, it doesn't seem to do that same filtering.
This PR fixes both those cases by correctly showing the updates as
unavailable
rather than not existing or ready to install. My main use case is that I want to be able to runwp plugin list
and see if a site is running the latest version of any installed plugin or theme. If not, I want to know if it is because the updates haven't been applied or if they are held back because of requirement changes in newer versions.