From a1d37e31749de9c75005cd044153b31c851528af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 22:31:31 +0000 Subject: [PATCH 1/6] Initial plan From 9d217acc6e5e3ba6448e4ff5024fb609d4dc8099 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 22:34:43 +0000 Subject: [PATCH 2/6] Fix --all --network flag to properly network-activate single-site active plugins Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/plugin.feature | 35 +++++++++++++++++++++++++++++++++++ src/Plugin_Command.php | 5 ++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/features/plugin.feature b/features/plugin.feature index 879f1e89d..8f0b8bada 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -298,6 +298,41 @@ Feature: Manage WordPress plugins """ And the return code should be 0 + Scenario: Network activate all plugins when some are already active on a single site + Given a WP multisite install + + When I run `wp plugin install wordpress-importer --activate` + Then STDOUT should contain: + """ + Plugin 'wordpress-importer' activated. + """ + + When I run `wp plugin list --fields=name,status` + Then STDOUT should be a table containing rows: + | name | status | + | akismet | inactive | + | wordpress-importer | active | + + When I run `wp plugin activate --all --network` + Then STDOUT should contain: + """ + Plugin 'akismet' network activated. + """ + And STDOUT should contain: + """ + Plugin 'wordpress-importer' network activated. + """ + And STDOUT should contain: + """ + Success: Network activated 2 of 2 plugins. + """ + + When I run `wp plugin list --fields=name,status` + Then STDOUT should be a table containing rows: + | name | status | + | akismet | active-network | + | wordpress-importer | active-network | + Scenario: List plugins Given a WP install diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 5ce246aca..6ea45a400 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -374,7 +374,10 @@ public function activate( $args, $assoc_args = [] ) { } foreach ( $plugins as $plugin ) { $status = $this->get_status( $plugin->file ); - if ( $all && in_array( $status, [ 'active', 'active-network' ], true ) ) { + // When using --all flag, skip plugins that are already in the target state. + // For --all --network, only skip plugins that are already network-active. + // For --all without --network, only skip plugins that are already active. + if ( $all && ( ( $network_wide && 'active-network' === $status ) || ( ! $network_wide && 'active' === $status ) ) ) { continue; } // Network-active is the highest level of activation status. From aad392fc74b5aec48dcb129b28ce8dd3cd2523f0 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 17 Feb 2026 14:10:35 +0100 Subject: [PATCH 3/6] Fix test --- features/plugin.feature | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/features/plugin.feature b/features/plugin.feature index 8f0b8bada..34839dabb 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -300,8 +300,10 @@ Feature: Manage WordPress plugins Scenario: Network activate all plugins when some are already active on a single site Given a WP multisite install + And I run `wp plugin delete --all` - When I run `wp plugin install wordpress-importer --activate` + When I run `wp plugin install debug-bar` + And I run `wp plugin install wordpress-importer --activate` Then STDOUT should contain: """ Plugin 'wordpress-importer' activated. @@ -310,13 +312,13 @@ Feature: Manage WordPress plugins When I run `wp plugin list --fields=name,status` Then STDOUT should be a table containing rows: | name | status | - | akismet | inactive | + | debug-bar | inactive | | wordpress-importer | active | When I run `wp plugin activate --all --network` Then STDOUT should contain: """ - Plugin 'akismet' network activated. + Plugin 'debug-bar' network activated. """ And STDOUT should contain: """ @@ -330,7 +332,7 @@ Feature: Manage WordPress plugins When I run `wp plugin list --fields=name,status` Then STDOUT should be a table containing rows: | name | status | - | akismet | active-network | + | debug-bar | active-network | | wordpress-importer | active-network | Scenario: List plugins From 3907186bcab20fc199c03b40003dbf037bddcfd9 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 17 Feb 2026 14:41:08 +0100 Subject: [PATCH 4/6] Fix test --- features/plugin.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/plugin.feature b/features/plugin.feature index 34839dabb..cacaa9966 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -298,6 +298,7 @@ Feature: Manage WordPress plugins """ And the return code should be 0 + @require-wp-5.2 Scenario: Network activate all plugins when some are already active on a single site Given a WP multisite install And I run `wp plugin delete --all` From 687c8338a479817cb79209a0acebf0092850e712 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 17 Feb 2026 15:17:28 +0100 Subject: [PATCH 5/6] Update src/Plugin_Command.php --- src/Plugin_Command.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 0b298fce7..cf8a42147 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -384,9 +384,8 @@ public function activate( $args, $assoc_args = [] ) { foreach ( $plugins as $plugin ) { $status = $this->get_status( $plugin->file ); // When using --all flag, skip plugins that are already in the target state. - // For --all --network, only skip plugins that are already network-active. - // For --all without --network, only skip plugins that are already active. - if ( $all && ! $force && ( ( $network_wide && 'active-network' === $status ) || ( ! $network_wide && 'active' === $status ) ) ) { + $target_status = $network_wide ? 'active-network' : 'active'; + if ( $all && ! $force && $target_status === $status ) { continue; } // Network-active is the highest level of activation status. From 6769a963c713935445ed99c9ccae626dda30ae64 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 17 Feb 2026 16:57:22 +0100 Subject: [PATCH 6/6] Update src/Plugin_Command.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Plugin_Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index c9e059169..587c6d259 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -384,8 +384,8 @@ public function activate( $args, $assoc_args = [] ) { foreach ( $plugins as $plugin ) { $status = $this->get_status( $plugin->file ); // When using --all flag, skip plugins that are already in the target state. - $target_status = $network_wide ? 'active-network' : 'active'; - if ( $all && ! $force && $target_status === $status ) { + $skip_statuses = $network_wide ? array( 'active-network' ) : array( 'active', 'active-network' ); + if ( $all && ! $force && in_array( $status, $skip_statuses, true ) ) { continue; } // Network-active is the highest level of activation status.