Skip to content
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 features/COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Legend: file names are under `features/`. Scenarios that assert the correct beha
| `--local-db` | database: Create a site with a local database container, restart `--db`, disable/enable, delete |
| `--with-local-redis` | cache: Create a site with cache on a local redis container; alone: not covered yet: `--with-local-redis` without `--cache` is silently ignored (its scenario comes back with the fix); restart policy: not covered yet: the local redis service has no restart policy (its scenario comes back with the fix) |
| `--public-dir` | install-options: Serve WordPress from a public directory…; without value: not covered yet: a bare `--public-dir` makes the public dir `htdocs/1` (its scenario comes back with the fix) |
| `--php` (13 options; 8.6 not covered until its image is published) | 8.5 default and update to 8.2: php-version: Default PHP version and update…; 8.3, 8.5, latest: Create a site on PHP <php>; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10, 08.5, ' 8.5'): not covered: core's synopsis check compares loosely and lets them through, then create() compares as strings: surrounding whitespace is trimmed, the rest gets the fallback prompt (`--php=8` asks to continue with 8.5; `--yes` takes it) |
| `--php` (13 options; 8.6 not covered until its image is published) | 8.5 default and update to 8.2: php-version: Default PHP version and update…; 8.3, 8.5, latest (stored as the default version, 8.5): Create a site on PHP <php>; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10, 08.5, ' 8.5'): not covered: core's synopsis check compares loosely and lets them through, then create() compares as strings: surrounding whitespace is trimmed, the rest gets the fallback prompt (`--php=8` asks to continue with 8.5; `--yes` takes it) |
| `--dbname`, `--dbuser`, `--dbpass` | database: Custom database name…, Deleting the site drops its custom database and user; remote: external-db; collisions: database ×3 |
| `--dbhost` (+ `:port`) | database: Remote database host requires credentials, Unreachable remote database rolls the site back; external-db: all scenarios |
| `--dbprefix`, `--dbcharset`, `--dbcollate`, `--skip-check` | database: Custom database name, user, password, prefix, charset and collation… |
Expand Down
13 changes: 7 additions & 6 deletions features/php-version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Feature: PHP versions of WordPress sites (--php on create and update)
When I run 'bin/ee site create bh-site-type-wp-php<name>.test --type=wp --php=<php>'
Then the command should succeed
And the site 'bh-site-type-wp-php<name>.test' info should contain:
| field | value |
| php_version | <php> |
| field | value |
| php_version | <stored> |
And the 'php' container of site 'bh-site-type-wp-php<name>.test' should use image 'easyengine/<image>:'
When In the 'php' container of site 'bh-site-type-wp-php<name>.test' I run 'php -v'
Then STDOUT should contain:
Expand All @@ -65,11 +65,12 @@ Feature: PHP versions of WordPress sites (--php on create and update)
When I run 'bin/ee site delete bh-site-type-wp-php<name>.test --yes'
Then the command should succeed

# `latest` is stored as the default version (8.5), so a later default bump doesn't move the site.
Examples:
| php | name | image | runtime |
| 8.3 | 83 | php8.3 | 8.3. |
| 8.5 | 85 | php8.5 | 8.5. |
| latest | latest | php8.5 | 8.5. |
| php | name | stored | image | runtime |
| 8.3 | 83 | 8.3 | php8.3 | 8.3. |
| 8.5 | 85 | 8.5 | php8.5 | 8.5. |
| latest | latest | 8.5 | php8.5 | 8.5. |

# These pull the older php images (not present on a fresh host) and need an older WordPress for PHP < 7.4.
@slow
Expand Down
4 changes: 4 additions & 0 deletions src/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ public function create( $args, $assoc_args ) {
}
\EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ), $assoc_args );
}
// Stored as the concrete version: a stored `latest` would move to a newer image on a later default bump and keep the old PHP config.
if ( 'latest' === $this->site_data['php_version'] ) {
$this->site_data['php_version'] = self::DEFAULT_PHP_VERSION;
}

if ( \EE\Utils\get_flag_value( $assoc_args, 'local-db' ) ) {
$this->site_data['db_host'] = 'db';
Expand Down