Skip to content

Commit

Permalink
Add --force-check flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnhooper committed Nov 10, 2023
1 parent 91b4e0c commit f30fe54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class Core_Command extends WP_CLI_Command {
* - yaml
* ---
*
* [--force-check]
* : Forces check even if WordPress is up to date.
*
* ## EXAMPLES
*
* $ wp core check-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

0 comments on commit f30fe54

Please sign in to comment.