playground-tools icon indicating copy to clipboard operation
playground-tools copied to clipboard

wp-now: "latest" WP never updates

Open squelchdesign opened this issue 1 year ago • 4 comments

I'm starting wp-now like this:

wp-now start --reset --blueprint=blueprint-wp-now.json

I first ran this when the latest WordPress was 6.4, and it correctly downloaded and used 6.4. Since then WP6.5 was rolled out, but wp-now continues to use 6.4:

$ wp-now start --reset --blueprint=blueprint-wp-now.json
Starting the server......
directory: /Users/lowey/devel/squelch-tabs-and-accordions-shortcodes
mode: plugin
php: 7.4
wp: latest
WordPress latest folder already exists. Skipping download.
…

Removing the "latest" directory before running wp-now triggers a re-download of "latest", bringing it up to the correct version:

$ rm -rf ~/.wp-now/wordpress-versions/latest
$ wp-now start --reset --blueprint=blueprint-wp-now.json
Starting the server......
directory: /Users/lowey/devel/squelch-tabs-and-accordions-shortcodes
mode: plugin
php: 7.4
wp: latest
Downloading WordPress latest...
…

Obviously it's good that wp-now doesn't download WordPress on every run, but it could do with checking whether what is in the "latest" dir matches what the update API says is the latest version.

squelchdesign avatar Apr 03 '24 13:04 squelchdesign

cc @sejas, I think a new wp-now release may be required. Although that's weird, I rememeber it used api.wp.org to fetch these versions.

adamziel avatar Apr 03 '24 17:04 adamziel

wp-now currently doesn't check updates. The decision was to avoid replacing the latest version by default, because you could have sites using that version and updating it for one will update it for all the sites.

I asked a similar question when the trunk version was introduced --wp=trunk. https://github.com/WordPress/playground-tools/pull/161#pullrequestreview-1890382317

I think a new flag to "force" download or "check" wp version updates would be very handy.

@squelchdesign, a new flag to check updates and download the new version if it exist would solve your issue?

sejas avatar Apr 05 '24 16:04 sejas

you could have sites using that version and updating it for one will update it for all the sites

Yes… but if I have, say, three websites that are all set to "latest" and they all get automatically updated to the latest version as a result, that seems right to me (the user asked for "latest" and they got "latest")? If the user wanted to explicity keep a site on 6.4 they could specify --wp=6.4 could they not / would they not?

Aside from the DB update I don't see any obvious issue with the latest version automatically updating in the background for all sites that are opting to use that version. It's not a huge problem either way, as it's hardly a massive burden to delete the "latest" directory from the .wp-now directory to force a fresh download, but if that's to be the behaviour I think the tool needs to be incredibly explicit about it, or users might just assume that "latest means latest" and not bother to check that they really are on the latest version.

squelchdesign avatar Apr 05 '24 16:04 squelchdesign

Agreed! I can prepare a PR and see if there is any pushback, which I don't expect to.

sejas avatar Apr 05 '24 16:04 sejas

@sejas I created a PR: https://github.com/WordPress/playground-tools/pull/324.

zaguiini avatar Jul 05 '24 20:07 zaguiini

Thanks for creating the PR! I assigned the issue to you.

sejas avatar Jul 10 '24 15:07 sejas

This has been done in https://github.com/WordPress/playground-tools/pull/324 and it's available in wp-nowv0.1.74. Users will automatically get updated the latest and nightly versions.

You can try it by running npx @wp-now/wp-now start or npx @wp-now/wp-now start --wp=nightly

Users who want to run a specific version should indicate it using the parameter wp. For example: --wp=6.0

@zaguiini , thanks for the contribution. @squelchdesign , thanks for suggesting it.

sejas avatar Jul 29 '24 11:07 sejas