WordPress / playground-tools

GNU General Public License v2.0
130 stars 39 forks source link

wp-now: "latest" WP never updates #214

Open squelchdesign opened 3 months ago

squelchdesign commented 3 months ago

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.

adamziel commented 3 months ago

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.

sejas commented 3 months ago

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?

squelchdesign commented 3 months ago

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.

sejas commented 3 months ago

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

zaguiini commented 2 weeks ago

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

sejas commented 1 week ago

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