core-command icon indicating copy to clipboard operation
core-command copied to clipboard

"wordpress is up to date" message displayed when attempting downgrade without --force

Open benlk opened this issue 6 years ago • 2 comments

With a WordPress site on WordPress 5.1 that I want to downgrade to 5.0.3 for testing:

$ wp core update --version=5.0.3
Success: WordPress is up to date.

There are several problems with this message:

  • "Success" is wrong; the installed WordPress version did not change
  • "up to date" is not the desired outcome. Could this message be expanded to "Wordpress is up to date at version $version"?
  • When attempting to "upgrade" to a version older than the currently-installed version, wp core update doesn't explain to the user why the version was not updated. Some additional verbosity here would be appreciated: "Did not upgrade to 5.0.3 because the newer version 5.1 is already installed. retry with --force to ignore this check."

A solution to this problem might look like:

  • [ ] Do not display "Success" if the safety checks in wp core update abort an update
  • [ ] Display the installed version number in "WordPress is up to date" messages
  • [ ] When an "upgrade" to an older version is blocked by the presence of a newer version, output a message saying that that is the case, listing the newer version currently installed, and provide a "did you mean to --force?" message
The successful command, which is irrelevant to this issue The successful command was:
$ wp core update --version=5.0.3 --force
Updating to version 5.0.3 (en_US)...
Downloading update from https://wordpress.org/wordpress-5.0.3.zip...
Unpacking the update...
Cleaning up files...
File removed: wp-includes/ms-site.php
File removed: wp-includes/ms-network.php
File removed: wp-includes/js/backbone.js
File removed: wp-includes/js/underscore.js
File removed: wp-includes/js/codemirror/fakejshint.js
File removed: wp-includes/js/codemirror/esprima.js
6 files cleaned up.
Success: WordPress updated successfully.

benlk avatar Mar 01 '19 20:03 benlk

@benlk Your proposed solution sounds good to me, with one potential caveat:

Do not display "Success" if the safety checks in wp core update abort an update

I'm not sure off the top of my head whether we can actually differentiate between "is up-to-date, all good" and "is higher already, abort". And for the purposes of CI systems, we don't want a scenario of "is up-to-date, all good" to throw an error and stop the pipeline.

schlessera avatar Mar 04 '19 17:03 schlessera

And for the purposes of CI systems, we don't want a scenario of "is up-to-date, all good" to throw an error and stop the pipeline.

This might be behavior to put behind a flag: --fail-if-higher to be used in conjunction with update --version=<version> causes failure if ${wp core version} is greater than <version>, but only if that flag is passed.

benlk avatar Mar 05 '19 23:03 benlk