Skip to content
Draft
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
38 changes: 38 additions & 0 deletions features/plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,44 @@ 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`

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.
"""

When I run `wp plugin list --fields=name,status`
Then STDOUT should be a table containing rows:
| name | status |
| debug-bar | inactive |
| wordpress-importer | active |

When I run `wp plugin activate --all --network`
Then STDOUT should contain:
"""
Plugin 'debug-bar' 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 |
| debug-bar | active-network |
| wordpress-importer | active-network |

Scenario: List plugins
Given a WP install

Expand Down
4 changes: 3 additions & 1 deletion src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,9 @@ public function activate( $args, $assoc_args = [] ) {
}
foreach ( $plugins as $plugin ) {
$status = $this->get_status( $plugin->file );
if ( $all && ! $force && in_array( $status, [ 'active', 'active-network' ], true ) ) {
// 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 ) {
continue;
}
// Network-active is the highest level of activation status.
Expand Down