Skip to content

Commit 5d9154d

Browse files
Nikschavanschlessera
authored andcommitted
Add '--skip-update-check' flag to plugin and theme list command
By default WP-CLI does a force update check when running 'wp plugin list' and 'wp theme list' '--skip-update-check' flag can be added to these commands which can bypass the force udpate check
1 parent 82bdf8b commit 5d9154d

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Plugin_Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,9 @@ public function delete( $args, $assoc_args = array() ) {
10821082
* - inactive
10831083
* - must-use
10841084
* ---
1085+
*
1086+
* [--skip-update-check]
1087+
* : If set, the plugin update check will be skipped.
10851088
*
10861089
* ## AVAILABLE FIELDS
10871090
*

src/Theme_Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ public function delete( $args, $assoc_args ) {
831831
* - parent
832832
* - inactive
833833
* ---
834+
*
835+
* [--skip-update-check]
836+
* : If set, the plugin update check will be skipped.
834837
*
835838
* ## AVAILABLE FIELDS
836839
*

src/WP_CLI/CommandWithUpgrade.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,11 @@ static function ( $result ) {
480480

481481
// phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Whitelisting to provide backward compatibility to classes possibly extending this class.
482482
protected function _list( $_, $assoc_args ) {
483-
// Force WordPress to check for updates
484-
call_user_func( $this->upgrade_refresh );
483+
484+
// Force WordPress to check for updates if `--skip-update-check` is not passed.
485+
if ( empty( $assoc_args['skip-update-check'] ) ) {
486+
call_user_func( $this->upgrade_refresh );
487+
}
485488

486489
$all_items = $this->get_all_items();
487490

0 commit comments

Comments
 (0)