diff --git a/README.md b/README.md index ead932b4..a6648c90 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ wp core Checks for WordPress updates via Version Check API. ~~~ -wp core check-update [--minor] [--major] [--field=] [--fields=] [--format=] +wp core check-update [--minor] [--major] [--force-check] [--field=] [--fields=] [--format=] ~~~ Lists the most recent versions when there are updates available, @@ -56,6 +56,9 @@ or success message when up to date. [--major] Compare only the first part of the version number. + [--force-check] + Bypass the transient cache and force a fresh update check. + [--field=] Prints the value of a single field for each update. diff --git a/src/Core_Command.php b/src/Core_Command.php index 1b82223a..c1dbd2d9 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -44,6 +44,9 @@ class Core_Command extends WP_CLI_Command { * [--major] * : Compare only the first part of the version number. * + * [--force-check] + * : Bypass the transient cache and force a fresh update check. + * * [--field=] * : Prints the value of a single field for each update. * @@ -1145,7 +1148,7 @@ public function update( $args, $assoc_args ) { return; } } elseif ( ! empty( $from_api->updates ) ) { - list( $update ) = $from_api->updates; + list( $update ) = $from_api->updates; } } elseif ( Utils\wp_version_compare( $assoc_args['version'], '<' ) || 'nightly' === $assoc_args['version'] @@ -1175,7 +1178,7 @@ public function update( $args, $assoc_args ) { if ( ! empty( $update ) && ( $update->version !== $wp_version - || Utils\get_flag_value( $assoc_args, 'force' ) ) ) { + || Utils\get_flag_value( $assoc_args, 'force' ) ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; @@ -1354,7 +1357,8 @@ private function get_download_url( $version, $locale = 'en_US', $file_type = 'zi * Returns update information. */ private function get_updates( $assoc_args ) { - wp_version_check(); + $force_check = Utils\get_flag_value( $assoc_args, 'force-check' ); + wp_version_check( [], $force_check ); $from_api = get_site_transient( 'update_core' ); if ( ! $from_api ) { return [];