wordpress-playground
wordpress-playground copied to clipboard
Document loading older WordPress versions with a Blueprint
As a developer, the Playground is a great way to test things out quickly. However, I have a specific need for one of my plugins to be able to test on back levels of WordPress (pre Block Editor) and would love to see Playground supporting this (to an extend - probably don't need it running WordPress v1!!).
Would it be possible to implement older releases of WordPress?
@dartiss I would love the PHP Blueprint library to support arbitrary .zip files as the WordPress version – you will then be able to start Playground with WordPress 4.5 :-) Just curious, what's the first WordPress version your plugin supports? And what's the plugin?
@adamziel my Transient Cleaner plugin only works on WordPress 5.8 or below.
running WordPress v1
The other day I was curious and found the earliest tagged version of WordPress 1.5
from 2005. It's interesting to see the basic folder/file structure has been the same all these years.
https://github.com/WordPress/wordpress-develop/tree/004508b63f772b3c976f2ce4b36e151c69234e26
It would be amusing to re-animate such a historic snapshot of WordPress. (The readme says "PHP version 4.1 or higher".) Even if it doesn't go so far back, Playground would be the perfect "retro emulator" for running older WordPress versions.
This would be ideal, when I first started using the https://playground.wordpress.net/ site there were older versions of WP in it, I believe 5.8 or 5.9 but they have since been removed. I hoped it was just removed from the UI so I tried modifying the URL to load 5.9 but it seemed to ignore that and load it in 6.4.
It would be really helpful if it was possible to load older versions... or at least if you stopped removing versions as new ones were added to the list. At our offices we are running different versions of WP and are usually behind several versions due to how large our environment is. The playground tool is super useful for quick tests or even just checking which features were released in which version of WordPress and seeing it evolve from version to version.
I'd rather not put these WordPress versions to the UI as:
- Most Playground users won't need them
- It would mean building Playground would require processing and supporting more and more WordPress bundles.
I still acknowledge they would be highly useful for you, so here's the next best approach.
With https://github.com/WordPress/wordpress-playground/pull/1154, you're now able to load older WordPress releases using a custom Blueprint:
{
"landingPage": "/wp-admin",
"steps": [
{
"step": "writeFile",
"path": "/tmp/wordpress.zip",
"data": {
"resource": "url",
"url": "https://playground.wordpress.net/plugin-proxy.php?url=https://wordpress.org/wordpress-5.9.9.zip",
"caption": "Downloading the WordPress Release"
}
},
{
"step": "importWordPressFiles",
"wordPressFilesZip": {
"resource": "vfs",
"path": "/tmp/wordpress.zip"
},
"pathInZip": "/wordpress",
"progress": {
"weight": 20,
"caption": "Importing the WordPress release"
}
},
{
"step": "runPHP",
"code": "<?php $_GET['step'] = 'upgrade_db'; require '/wordpress/wp-admin/upgrade.php'; "
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
Just need to switch "url": "https://playground.wordpress.net/plugin-proxy.php?url=https://wordpress.org/wordpress-5.9.9.zip",
for the WordPress.org-hosted WordPress ZIP release you want to use.
The next steps in this issue would be either of these:
- Adding these older WordPress versions to the version picker. I'm less excited about this one as we'd have a single select box with two different effects – it would either download a Playground-optimized WP release or a large ZIP bundle of an official WP release. Instead, I'd rather...
- Document how to use the above Blueprint to load older WordPress releases. Perhaps even link to that doc page from the UI, e.g. "Need an older WordPress version?"
The oldest WordPress version that worked for me this way is 5.9.9
– I don't think the SQLite integration plugin works with WordPress versions <= 5.8.
I have no plans to work on adding that support as there's a lot of foundational work to make sure Playground is stable, well documented etc. If SQLite on WordPress <= 5.8 is something you could use, you can make it happen by contributing to the SQLite integration plugin – I'm sure @aristats will value your inputs.
Document how to use the above Blueprint to load older WordPress releases. Perhaps even link to that doc page from the UI, e.g. "Need an older WordPress version?"
That's a good place for it.
Maybe this could also be a good opportunity to reorder the buttons inside the Additional actions pop-out menu?
Happy to take a shot at this in a PR :-)
BTW, an interesting tidbit: versions 5.9-6.5 cover 83% of the "market"
@ironnysh yay! Let's continue the conversation in https://github.com/WordPress/wordpress-playground/pull/1235.
Hi,
This blueprint (also available in playground documentation) don’t work anymore.
{
"landingPage": "/wp-admin",
"steps": [
{
"step": "writeFile",
"path": "/tmp/wordpress.zip",
"data": {
"resource": "url",
"url": "https://playground.wordpress.net/plugin-proxy.php?url=https://wordpress.org/wordpress-5.9.9.zip",
"caption": "Downloading the WordPress Release"
}
},
{
"step": "importWordPressFiles",
"wordPressFilesZip": {
"resource": "vfs",
"path": "/tmp/wordpress.zip"
},
"pathInZip": "/wordpress",
"progress": {
"weight": 20,
"caption": "Importing the WordPress release"
}
},
{
"step": "runPHP",
"code": "<?php $_GET['step'] = 'upgrade_db'; require '/wordpress/wp-admin/upgrade.php'; "
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}