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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ wp core
Checks for WordPress updates via Version Check API.

~~~
wp core check-update [--minor] [--major] [--field=<field>] [--fields=<fields>] [--format=<format>]
wp core check-update [--minor] [--major] [--force-check] [--field=<field>] [--fields=<fields>] [--format=<format>]
~~~

Lists the most recent versions when there are updates available,
Expand All @@ -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=<field>]
Prints the value of a single field for each update.

Expand Down
10 changes: 7 additions & 3 deletions src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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=<field>]
* : Prints the value of a single field for each update.
*
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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 [];
Expand Down