diff --git a/README.md b/README.md index 4e2be2c1..2962b80d 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Subsequent uses of command will use the local cache if it still exists. Select which language you want to download. [--version=] - Select which version you want to download. Accepts a version number, 'latest' or 'nightly'. + Select which version you want to download. Accepts a version number, 'latest', 'beta', 'rc', or 'nightly'. [--skip-content] Download WP without the default themes and plugins. @@ -359,7 +359,7 @@ update isn't actually running. Only perform updates for minor releases (e.g. update from WP 4.3 to 4.3.3 instead of 4.4.2). [--version=] - Update to a specific version, instead of to the latest version. Alternatively accepts 'nightly'. + Update to a specific version, instead of to the latest version. Alternatively accepts 'latest', 'beta', 'rc', or 'nightly'. [--force] Update even when installed WP version is greater than the requested version. diff --git a/src/Core_Command.php b/src/Core_Command.php index a4c0e58a..80c3c78e 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -36,6 +36,8 @@ class Core_Command extends WP_CLI_Command { * Lists the most recent versions when there are updates available, * or success message when up to date. * + * @todo how does this behave with beta/rc/nightly? + * * ## OPTIONS * * [--minor] @@ -114,7 +116,7 @@ public function check_update( $_, $assoc_args ) { * : Select which language you want to download. * * [--version=] - * : Select which version you want to download. Accepts a version number, 'latest' or 'nightly'. + * : Select which version you want to download. Accepts a version number, 'latest', 'beta', 'rc', or 'nightly'. * * [--skip-content] * : Download WP without the default themes and plugins. @@ -327,9 +329,9 @@ function () use ( $temp ) { copy( $temp, $download_dir . basename( $temp ) ); } - // Do not use the cache for nightly builds or for downloaded URLs + // Do not use the cache for beta/rc/nightly builds or for downloaded URLs // (the URL could be something like "latest.zip" or "nightly.zip"). - if ( ! $from_url && 'nightly' !== $version ) { + if ( ! $from_url && ! in_array( $version, [ 'beta', 'rc', 'nightly' ], true ) ) { $cache->import( $cache_key, $temp ); } } @@ -1058,7 +1060,7 @@ private static function get_core_checksums( $version, $locale, $insecure ) { * : Only perform updates for minor releases (e.g. update from WP 4.3 to 4.3.3 instead of 4.4.2). * * [--version=] - * : Update to a specific version, instead of to the latest version. Alternatively accepts 'nightly'. + * : Update to a specific version, instead of to the latest version. Alternatively accepts 'latest', 'beta', 'rc', or 'nightly'. * * [--force] * : Update even when installed WP version is greater than the requested version. @@ -1149,6 +1151,8 @@ public function update( $args, $assoc_args ) { list( $update ) = $from_api->updates; } } elseif ( Utils\wp_version_compare( $assoc_args['version'], '<' ) + || 'beta' === $assoc_args['version'] + || 'rc' === $assoc_args['version'] || 'nightly' === $assoc_args['version'] || Utils\get_flag_value( $assoc_args, 'force' ) ) { @@ -1338,6 +1342,7 @@ public function update_db( $args, $assoc_args ) { * @return string */ private function get_download_url( $version, $locale = 'en_US', $file_type = 'zip' ) { + // @todo if ( 'nightly' === $version ) { if ( 'zip' === $file_type ) { diff --git a/src/WP_CLI/Core/CoreUpgrader.php b/src/WP_CLI/Core/CoreUpgrader.php index 1431b3d3..b5c5b4d2 100644 --- a/src/WP_CLI/Core/CoreUpgrader.php +++ b/src/WP_CLI/Core/CoreUpgrader.php @@ -93,6 +93,7 @@ function () use ( $temp ) { $cache_key = "core/{$filename}-{$update->locale}.{$extension}"; $cache_file = $cache->has( $cache_key ); + // @todo if ( $cache_file && false === stripos( $package, 'https://wordpress.org/nightly-builds/' ) && false === stripos( $package, 'http://wordpress.org/nightly-builds/' ) ) { WP_CLI::log( "Using cached file '{$cache_file}'..." ); @@ -125,6 +126,7 @@ function () use ( $temp ) { return new WP_Error( 'download_failed', $this->strings['download_failed'] ); } + // @todo if ( false === stripos( $package, 'https://wordpress.org/nightly-builds/' ) ) { $cache->import( $cache_key, $temp ); }