Skip to content
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

Docs: Update WordPress versions used in the documentation, document using older releases #1235

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docs/site/docs/02-start-using/01-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Compatibility testing with so many WordPres and PHP versions was always a pain.

You can also use the `wp` and `php` query parameters to open Playground with the right versions already loaded:

- https://playground.wordpress.net/?wp=5.9
- https://playground.wordpress.net/?wp=6.5
- https://playground.wordpress.net/?php=7.4
- https://playground.wordpress.net/?php=8.2&wp=6.2

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/site/docs/08-query-api/01-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can go ahead and try it out. The Playground will automatically install the t
| Option | Default Value | Description |
| ---------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `php` | `8.0` | Loads the specified PHP version. Supported values: `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, `8.3`, `latest` |
| `wp` | `latest` | Loads the specified WordPress version. Supported values: `6.0`, `6.1`, `6.2`, `6.3`, `6.4`, `latest`, `nightly`, `beta` |
| `wp` | `latest` | Loads the specified WordPress version. Supported values: The last three major WordPress versions. As of April 4, 2024, that's `6.3`, `6.4`, `6.5`. You can also use these values: `latest`, `nightly`, `beta` |
| `blueprint-url` | | The URL of the Blueprint that will be used to configure this Playground instance. |
| `php-extension-bundle` | | Loads a bundle of PHP extensions. Supported bundles: `kitchen-sink` (for finfo, gd, mbstring, iconv, openssl, libxml, xml, dom, simplexml, xmlreader, xmlwriter), `light` (saves 6MB of downloads, loads none of the above extensions) |
| `networking` | `yes` or `no` | Enables or disables the networking support for Playground. Defaults to `no` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ For example, to create a Playground with specific versions of WordPress and PHP
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"php": "7.4",
"wp": "5.9"
"wp": "6.5"
}
}
```

And then you would go to
`https://playground.wordpress.net/#{"preferredVersions": {"php":"7.4", "wp":"5.9"}}`.
`https://playground.wordpress.net/#{"preferredVersions": {"php":"7.4", "wp":"6.5"}}`.

You won't have to paste links to follow along. We'll use code examples with a "Try it out" button that will automatically run the examples for you:

<BlueprintExample justButton={true} blueprint={{
"preferredVersions": {
"php": "7.4",
"wp": "5.9"
"wp": "6.5"
}
}} />

Expand Down
6 changes: 3 additions & 3 deletions packages/docs/site/docs/09-blueprints-api/03-data-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import BlueprintExample from '@site/src/components/Blueprints/BlueprintExample.m
"landingPage": "/wp-admin/",
"preferredVersions": {
"php": "7.4",
"wp": "5.9"
"wp": "6.5"
},
"phpExtensionBundles": ["kitchen-sink"],
"features": {
Expand Down Expand Up @@ -50,8 +50,8 @@ JSON files can be tedious to write and easy to get wrong. To help with that, Pla

The `preferredVersions` property, unsurprisingly, declares the preferred of PHP and WordPress versions to use. It can contain the following properties:

- `php` (string): The preferred PHP version to use. Defaults to 'latest'. Only accepts major versions like "7.4" or "8.0". Minor versions like "7.4.1" are not supported.
- `wp` (string): The preferred WordPress version to use. Defaults to 'latest'. Only accepts major versions like "5.9" or "6.0". Minor versions like "5.9.1" are not supported.
- `php` (string): The preferred PHP version to use. Defaults to "latest". Only accepts major versions, like "7.4" or "8.0". Minor versions like "7.4.1" are not supported.
- `wp` (string): Loads the specified WordPress version. Supported values: The last three major WordPress versions—minor versions, like `6.5.1`, are not supported. As of April 4, 2024, that's `6.3`, `6.4`, `6.5`. You can also use these values: `latest` (default), `nightly`, or `beta`.

## PHP extensions

Expand Down
42 changes: 42 additions & 0 deletions packages/docs/site/docs/09-blueprints-api/08-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,45 @@ Use the `writeFile` step to add code to a mu-plugin that runs on every request.
}} />

You can share your own Blueprint examples in [this dedicated wiki](https://github.com/WordPress/wordpress-playground/wiki/Blueprint-examples).

## Load an older WordPress version

Playground only ships with a few recent WordPress releases. If you need to use an older version, this Blueprint can help you: change the version number in `"url": "https://playground.wordpress.net/plugin-proxy.php?url=https://wordpress.org/wordpress-5.9.9.zip"` from `5.9.9` to the release you want to load.

**Note:** the oldest supported WordPress version is `5.9.9`, following the SQLite integration plugin.

<BlueprintExample 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"
}
]
}} />
Original file line number Diff line number Diff line change
Expand Up @@ -312,29 +312,49 @@ export function PlaygroundConfigurationForm({
>
WordPress Version
</label>
<select
id="wp-version"
value={wp}
className={forms.largeSelect}
onChange={(
event: React.ChangeEvent<HTMLSelectElement>
) => {
setWp(event.target.value as string);
<div
style={{
display: 'flex',
gap: '0.5rem',
flexDirection: 'column',
}}
>
{/*
* Without an empty option, React sometimes says
* the current selected version is "nightly" when
* `wp` is actually "6.4".
*/}
<option value="">-- Select a version --</option>
{Object.keys(supportedWPVersions).map((version) => (
<option key={version} value={version}>
WordPress {supportedWPVersions[version]}
&nbsp;&nbsp;
</option>
))}
</select>
<select
id="wp-version"
value={wp}
className={forms.largeSelect}
onChange={(
event: React.ChangeEvent<HTMLSelectElement>
) => {
setWp(event.target.value as string);
}}
>
{/*
* Without an empty option, React sometimes says
* the current selected version is "nightly" when
* `wp` is actually "6.4".
*/}
<option value="">-- Select a version --</option>
{Object.keys(supportedWPVersions).map(
(version) => (
<option key={version} value={version}>
WordPress{' '}
{supportedWPVersions[version]}
&nbsp;&nbsp;
</option>
)
)}
</select>
<br />
<a
href="https://wordpress.github.io/wordpress-playground/blueprints-api/examples#load-an-older-wordpress-version"
target="_blank"
rel="noreferrer"
style={{ fontSize: '0.9em' }}
>
Need an older version?
</a>
</div>
</div>
<div className={forms.submitRow}>
<Button type="submit" variant="primary" size="large">
Expand Down
Loading