Use --skip-content to download WordPress without default themes/plugins (US locale only)#37
Conversation
src/Core_Command.php
Outdated
| } | ||
|
|
||
| if ( true === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-content' ) ) { | ||
| $offer = unserialize( self::_read( 'https://api.wordpress.org/core/version-check/1.6/' ) ); |
There was a problem hiding this comment.
Any reason for not using https://api.wordpress.org/core/version-check/1.7/ which provides JSON data?
There was a problem hiding this comment.
Gotcha, maybe there's a reason... cc @danielbachhuber
There was a problem hiding this comment.
Here's the original commit: wp-cli/wp-cli@3fbef8b
My assumption is that 1.7 wasn't available.
There was a problem hiding this comment.
Thanks @danielbachhuber,
Would you like to continue using 1.6 or should we change to 1.7?
| $offer = unserialize( self::_read( 'https://api.wordpress.org/core/version-check/1.6/' ) ); | ||
| $download_url = $offer['offers'][0]["packages"]["no_content"]; | ||
| $version = $offer['offers'][0]["current"].' without content'; | ||
| } |
There was a problem hiding this comment.
Since there's a Nightly builds are only available for the en_US locale. error, packages with no content are also only available for the en_US locale.
There was a problem hiding this comment.
Thanks @ocean90, I've just added this AaronRutley@dd9a40c
features/core-download.feature
Outdated
| When I run `wp core download --skip-content` | ||
| And save STDOUT 'Downloading WordPress ([\d\.]+)' as {VERSION} | ||
| Then the wp-settings.php file should exist | ||
| And the {SUITE_CACHE_DIR}/core/wordpress-{WP_VERSION-latest}-without-content-en_US.zip file should exist |
There was a problem hiding this comment.
Can you create a new Scenario for this behavior please (instead of repurposing an existing one)?
There was a problem hiding this comment.
We'll also need to make sure there are tests for:
- Non US locales
- Use of
--version=<version>
There was a problem hiding this comment.
Thanks @danielbachhuber, I've just created 3 new scenarios.
|
|
||
| if ( true === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-content' ) && 'en_US' !== $locale ) { | ||
| WP_CLI::error( 'The skip content build is only available for the en_US locale.' ); | ||
| } |
There was a problem hiding this comment.
I think it would make sense to render this error earlier on, to avoid an unnecessary HTTP request when the error will render.
Also, did you confirm this is the case? That --skip-content is available for the en_US locale?
There was a problem hiding this comment.
Thanks @danielbachhuber, I've moved this check to earlier on.
Yes, as I understand, --skip-content is only available for the en_US locale.
features/core-download.feature
Outdated
| Given an empty directory | ||
| And an empty cache | ||
|
|
||
| When I run `wp core download --skip-content --locale=nl_NL` |
There was a problem hiding this comment.
This should be When I try, because the expected result is an error.
features/core-download.feature
Outdated
| And an empty cache | ||
|
|
||
| When I run `wp core download --skip-content --locale=nl_NL` | ||
| Then STDOUT should contain: |
There was a problem hiding this comment.
This should be Then STDERR should contain
features/core-download.feature
Outdated
| Given an empty directory | ||
| And an empty cache | ||
|
|
||
| When I run `wp core download --skip-content --version=4.7` |
features/core-download.feature
Outdated
| And an empty cache | ||
|
|
||
| When I run `wp core download --skip-content --version=4.7` | ||
| Then STDOUT should contain: |
src/Core_Command.php
Outdated
| * : Overwrites existing files, if present. | ||
| * | ||
| * [--skip-content] | ||
| * : Download the latest version of WP without the default themes and plugins |
There was a problem hiding this comment.
Can we include some mention that this only works when locale is en_US?
There was a problem hiding this comment.
For sure, I've just updated.
src/Core_Command.php
Outdated
|
|
||
| if ( true === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-content' ) ) { | ||
| $offer = unserialize( self::_read( 'https://api.wordpress.org/core/version-check/1.6/' ) ); | ||
| $download_url = $offer['offers'][0]["packages"]["no_content"]; |
There was a problem hiding this comment.
We need to check that $offer['offers'][0]["packages"]["no_content"]; is set, and error if it's not.
There was a problem hiding this comment.
Thanks for your feedback, I've just addressed this!
src/Core_Command.php
Outdated
| } | ||
|
|
||
| if ( true === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-content' ) ) { | ||
| $offer = unserialize( self::_read( 'https://api.wordpress.org/core/version-check/1.6/' ) ); |
There was a problem hiding this comment.
Let's switch this to the v1.7 API
There was a problem hiding this comment.
Thanks for your feedback, I've just addressed this!
|
Thanks for your work on this @AaronRutley ! |
--skip-content to download WordPress without default themes/plugins (US locale only)
Allow users to install WordPress without content eg:
wp core download --skip-contentSee these issues for context #36 & wp-cli/ideas#59
This is my first pass, please let me know what needs improvement.