Skip to content

Commit df6c17d

Browse files
Copilotswissspidy
andcommitted
Refactor mu-plugin merging logic using array_replace
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 40a936e commit df6c17d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Plugin_Command.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,9 @@ protected function get_all_items() {
240240
$items = $this->get_item_list();
241241

242242
// Get all mu-plugins including those in subfolders.
243-
$mu_plugins = get_mu_plugins();
244-
$mu_plugins_subfolder = get_plugins( '/../' . basename( WPMU_PLUGIN_DIR ) );
245-
foreach ( $mu_plugins_subfolder as $file => $plugin_data ) {
246-
if ( ! isset( $mu_plugins[ $file ] ) ) {
247-
$mu_plugins[ $file ] = $plugin_data;
248-
}
249-
}
243+
$mu_plugins_from_root = get_mu_plugins();
244+
$all_mu_plugins = get_plugins( '/../' . basename( WPMU_PLUGIN_DIR ) );
245+
$mu_plugins = array_replace( $all_mu_plugins, $mu_plugins_from_root );
250246

251247
foreach ( $mu_plugins as $file => $mu_plugin ) {
252248
$mu_version = '';

0 commit comments

Comments
 (0)