File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -817,6 +817,31 @@ Feature: Manage WordPress plugins
817817 | name | title | description |
818818 | test -mu | Test mu -plugin | Test mu -plugin description |
819819
820+ Scenario : Listing mu-plugins should include plugins from subfolders
821+ Given a WP install
822+ And a wp-content/mu-plugins/test-mu-root.php file:
823+ """
824+ <?php
825+ // Plugin Name: Test MU Root
826+ // Description: Test mu-plugin in root
827+ // Version: 1.0.0
828+ """
829+ And a wp-content/mu-plugins/subfolder-plugin/subfolder-plugin.php file:
830+ """
831+ <?php
832+ /**
833+ * Plugin Name: Subfolder MU Plugin
834+ * Description: Test mu-plugin in subfolder
835+ * Version: 2.0.0
836+ */
837+ """
838+
839+ When I run `wp plugin list --status=must-use --fields=name,title,version`
840+ Then STDOUT should be a table containing rows:
841+ | name | title | version |
842+ | test -mu -root | Test MU Root | 1 .0 .0 |
843+ | subfolder -plugin | Subfolder MU Plugin | 2 .0 .0 |
844+
820845 @require-wp-5.5
821846 Scenario : Listing plugins should include name and auto_update
822847 Given a WP install
Original file line number Diff line number Diff line change @@ -333,7 +333,12 @@ protected function status_single( $args ) {
333333 protected function get_all_items () {
334334 $ items = $ this ->get_item_list ();
335335
336- foreach ( get_mu_plugins () as $ file => $ mu_plugin ) {
336+ // Get all mu-plugins including those in subfolders.
337+ $ mu_plugins_from_root = get_mu_plugins ();
338+ $ all_mu_plugins = get_plugins ( '/../ ' . basename ( WPMU_PLUGIN_DIR ) );
339+ $ mu_plugins = array_replace ( $ all_mu_plugins , $ mu_plugins_from_root );
340+
341+ foreach ( $ mu_plugins as $ file => $ mu_plugin ) {
337342 $ mu_version = '' ;
338343 if ( ! empty ( $ mu_plugin ['Version ' ] ) ) {
339344 $ mu_version = $ mu_plugin ['Version ' ];
You can’t perform that action at this time.
0 commit comments