From 1787d0fcbdee6a6ed96119fc770f07bb3358bec6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:47:26 +0000 Subject: [PATCH 1/7] Initial plan From 175baf66bcdc0f4e9974e295abdd525ad74af2bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:50:40 +0000 Subject: [PATCH 2/7] Add custom ExtensionUpgraderSkin to display plugin names during updates Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/plugin-update.feature | 22 +++++++++++++++++ src/WP_CLI/CommandWithUpgrade.php | 36 +++++++++++++++++++++++++++- src/WP_CLI/ExtensionUpgraderSkin.php | 24 +++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/WP_CLI/ExtensionUpgraderSkin.php diff --git a/features/plugin-update.feature b/features/plugin-update.feature index a028b8df..1cf5e248 100644 --- a/features/plugin-update.feature +++ b/features/plugin-update.feature @@ -267,3 +267,25 @@ Feature: Update WordPress plugins """ Success: Updated 1 of 1 plugins (1 skipped). """ + + @require-wp-5.2 + Scenario: Updating all plugins should show the name of each plugin as it is updated + Given a WP install + And I run `wp plugin delete akismet` + + When I run `wp plugin install health-check --version=1.5.0` + Then STDOUT should not be empty + + When I run `wp plugin install wordpress-importer --version=0.5` + Then STDOUT should not be empty + + When I try `wp plugin update --all` + Then STDOUT should contain: + """ + Updating Health Check & Troubleshooting... + """ + + And STDOUT should contain: + """ + Success: Updated 2 of 2 plugins. + """ diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index 52f9f5bf..b8fb071a 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -389,7 +389,41 @@ protected function get_upgrader( $assoc_args ) { $force = Utils\get_flag_value( $assoc_args, 'force', false ); $insecure = Utils\get_flag_value( $assoc_args, 'insecure', false ); $upgrader_class = $this->get_upgrader_class( $force ); - return Utils\get_upgrader( $upgrader_class, $insecure ); + + // Use custom upgrader skin for extensions to display update progress + if ( ! class_exists( '\WP_Upgrader' ) ) { + if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { + include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; + } + } + + if ( ! class_exists( '\WP_Upgrader_Skin' ) ) { + if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php' ) ) { + include ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; + } + } + + $uses_insecure_flag = false; + + $reflection = new \ReflectionClass( $upgrader_class ); + $constructor = $reflection->getConstructor(); + if ( $constructor ) { + $arguments = $constructor->getParameters(); + foreach ( $arguments as $argument ) { + if ( 'insecure' === $argument->name ) { + $uses_insecure_flag = true; + break; + } + } + } + + $skin = new ExtensionUpgraderSkin(); + + if ( $uses_insecure_flag ) { + return new $upgrader_class( $skin, $insecure ); + } + + return new $upgrader_class( $skin ); } protected function update_many( $args, $assoc_args ) { diff --git a/src/WP_CLI/ExtensionUpgraderSkin.php b/src/WP_CLI/ExtensionUpgraderSkin.php new file mode 100644 index 00000000..1aea4035 --- /dev/null +++ b/src/WP_CLI/ExtensionUpgraderSkin.php @@ -0,0 +1,24 @@ +plugin_info ) && is_array( $this->plugin_info ) && isset( $this->plugin_info['Name'] ) ) { + WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->plugin_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); + } elseif ( isset( $this->theme_info ) && is_array( $this->theme_info ) && isset( $this->theme_info['Name'] ) ) { + WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); + } + } +} From e2f819f6490a71baf9551e2ae14ee67e3a2262a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:51:41 +0000 Subject: [PATCH 3/7] Fix code style and add phpcs exclusion for ExtensionUpgraderSkin Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- phpcs.xml.dist | 1 + src/WP_CLI/CommandWithUpgrade.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index d0cb7801..96cef65a 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -61,6 +61,7 @@ */src/WP_CLI/CommandWithUpgrade\.php$ */src/WP_CLI/(CommandWith|DestructivePlugin|DestructiveTheme)Upgrader\.php$ */src/WP_CLI/Parse(Plugin|Theme)NameInput\.php$ + */src/WP_CLI/ExtensionUpgraderSkin\.php$ diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index b8fb071a..5fc2d573 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -389,7 +389,7 @@ protected function get_upgrader( $assoc_args ) { $force = Utils\get_flag_value( $assoc_args, 'force', false ); $insecure = Utils\get_flag_value( $assoc_args, 'insecure', false ); $upgrader_class = $this->get_upgrader_class( $force ); - + // Use custom upgrader skin for extensions to display update progress if ( ! class_exists( '\WP_Upgrader' ) ) { if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { From 07282aa145ee3b490dc4f989ffd5a4cce1917490 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:52:54 +0000 Subject: [PATCH 4/7] Update ExtensionUpgraderSkin to properly handle themes and add theme update test Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/theme-update.feature | 22 ++++++++++++++++++++++ src/WP_CLI/ExtensionUpgraderSkin.php | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/features/theme-update.feature b/features/theme-update.feature index 4179b6a6..adc546b0 100644 --- a/features/theme-update.feature +++ b/features/theme-update.feature @@ -154,3 +154,25 @@ Feature: Update WordPress themes """ 1.1.1 """ + + @require-wp-4.5 + Scenario: Updating all themes should show the name of each theme as it is updated + Given a WP install + And I run `wp theme delete --all --force` + + When I run `wp theme install moina --version=1.0.2` + Then STDOUT should not be empty + + When I run `wp theme install twentytwelve --version=1.0` + Then STDOUT should not be empty + + When I try `wp theme update --all` + Then STDOUT should contain: + """ + Updating Moina... + """ + + And STDOUT should contain: + """ + Success: Updated 2 of 2 themes. + """ diff --git a/src/WP_CLI/ExtensionUpgraderSkin.php b/src/WP_CLI/ExtensionUpgraderSkin.php index 1aea4035..3c9db76e 100644 --- a/src/WP_CLI/ExtensionUpgraderSkin.php +++ b/src/WP_CLI/ExtensionUpgraderSkin.php @@ -17,8 +17,8 @@ class ExtensionUpgraderSkin extends UpgraderSkin { public function before() { if ( isset( $this->plugin_info ) && is_array( $this->plugin_info ) && isset( $this->plugin_info['Name'] ) ) { WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->plugin_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); - } elseif ( isset( $this->theme_info ) && is_array( $this->theme_info ) && isset( $this->theme_info['Name'] ) ) { - WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); + } elseif ( isset( $this->theme_info ) && is_object( $this->theme_info ) && method_exists( $this->theme_info, 'get' ) ) { + WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info->get( 'Name' ), ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); } } } From a913b355b36b6e5f227c2dcffb9b459b22a964e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:54:57 +0000 Subject: [PATCH 5/7] Add detailed comments explaining the code duplication in get_upgrader Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/WP_CLI/CommandWithUpgrade.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index 5fc2d573..b3fcd86b 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -390,7 +390,10 @@ protected function get_upgrader( $assoc_args ) { $insecure = Utils\get_flag_value( $assoc_args, 'insecure', false ); $upgrader_class = $this->get_upgrader_class( $force ); - // Use custom upgrader skin for extensions to display update progress + // We need to use ExtensionUpgraderSkin instead of the default UpgraderSkin + // to display which extension is being updated. Since the skin is passed to + // the upgrader constructor and cannot be changed afterward, we must duplicate + // the upgrader creation logic from Utils\get_upgrader() here. if ( ! class_exists( '\WP_Upgrader' ) ) { if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; @@ -403,6 +406,10 @@ protected function get_upgrader( $assoc_args ) { } } + // Check if the upgrader class constructor supports the insecure flag. + // This check is done on each call to maintain compatibility with the + // original Utils\get_upgrader() behavior, though it could be optimized + // with caching if performance becomes a concern. $uses_insecure_flag = false; $reflection = new \ReflectionClass( $upgrader_class ); From 0f6a304f9864750d03277ed93e736e52102e470e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sun, 1 Feb 2026 21:24:30 -0500 Subject: [PATCH 6/7] Simplify --- src/WP_CLI/CommandWithUpgrade.php | 43 +------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index b3fcd86b..81f4e87a 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -389,48 +389,7 @@ protected function get_upgrader( $assoc_args ) { $force = Utils\get_flag_value( $assoc_args, 'force', false ); $insecure = Utils\get_flag_value( $assoc_args, 'insecure', false ); $upgrader_class = $this->get_upgrader_class( $force ); - - // We need to use ExtensionUpgraderSkin instead of the default UpgraderSkin - // to display which extension is being updated. Since the skin is passed to - // the upgrader constructor and cannot be changed afterward, we must duplicate - // the upgrader creation logic from Utils\get_upgrader() here. - if ( ! class_exists( '\WP_Upgrader' ) ) { - if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { - include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; - } - } - - if ( ! class_exists( '\WP_Upgrader_Skin' ) ) { - if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php' ) ) { - include ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; - } - } - - // Check if the upgrader class constructor supports the insecure flag. - // This check is done on each call to maintain compatibility with the - // original Utils\get_upgrader() behavior, though it could be optimized - // with caching if performance becomes a concern. - $uses_insecure_flag = false; - - $reflection = new \ReflectionClass( $upgrader_class ); - $constructor = $reflection->getConstructor(); - if ( $constructor ) { - $arguments = $constructor->getParameters(); - foreach ( $arguments as $argument ) { - if ( 'insecure' === $argument->name ) { - $uses_insecure_flag = true; - break; - } - } - } - - $skin = new ExtensionUpgraderSkin(); - - if ( $uses_insecure_flag ) { - return new $upgrader_class( $skin, $insecure ); - } - - return new $upgrader_class( $skin ); + return Utils\get_upgrader( $upgrader_class, $insecure, new ExtensionUpgraderSkin() ); } protected function update_many( $args, $assoc_args ) { From bb30a4f8e25dbb811691595e955aaa9040654e5e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 2 Feb 2026 20:42:44 -0500 Subject: [PATCH 7/7] Load missing class --- src/WP_CLI/CommandWithUpgrade.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index 81f4e87a..63c7776e 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -389,6 +389,13 @@ protected function get_upgrader( $assoc_args ) { $force = Utils\get_flag_value( $assoc_args, 'force', false ); $insecure = Utils\get_flag_value( $assoc_args, 'insecure', false ); $upgrader_class = $this->get_upgrader_class( $force ); + + if ( ! class_exists( '\WP_Upgrader_Skin' ) ) { + if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php' ) ) { + include ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; + } + } + return Utils\get_upgrader( $upgrader_class, $insecure, new ExtensionUpgraderSkin() ); }