Skip to content
Open
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
25 changes: 25 additions & 0 deletions features/plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,31 @@ Feature: Manage WordPress plugins
| name | title | description |
| test-mu | Test mu-plugin | Test mu-plugin description |

Scenario: Listing mu-plugins should include plugins from subfolders
Given a WP install
And a wp-content/mu-plugins/test-mu-root.php file:
"""
<?php
// Plugin Name: Test MU Root
// Description: Test mu-plugin in root
// Version: 1.0.0
"""
And a wp-content/mu-plugins/subfolder-plugin/subfolder-plugin.php file:
"""
<?php
/**
* Plugin Name: Subfolder MU Plugin
* Description: Test mu-plugin in subfolder
* Version: 2.0.0
*/
"""

When I run `wp plugin list --status=must-use --fields=name,title,version`
Then STDOUT should be a table containing rows:
| name | title | version |
| test-mu-root | Test MU Root | 1.0.0 |
| subfolder-plugin | Subfolder MU Plugin | 2.0.0 |

@require-wp-5.5
Scenario: Listing plugins should include name and auto_update
Given a WP install
Expand Down
7 changes: 6 additions & 1 deletion src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ protected function status_single( $args ) {
protected function get_all_items() {
$items = $this->get_item_list();

foreach ( get_mu_plugins() as $file => $mu_plugin ) {
// Get all mu-plugins including those in subfolders.
$mu_plugins_from_root = get_mu_plugins();
$all_mu_plugins = get_plugins( '/../' . basename( WPMU_PLUGIN_DIR ) );
$mu_plugins = array_replace( $all_mu_plugins, $mu_plugins_from_root );

foreach ( $mu_plugins as $file => $mu_plugin ) {
$mu_version = '';
if ( ! empty( $mu_plugin['Version'] ) ) {
$mu_version = $mu_plugin['Version'];
Expand Down