Commit ee69ec404e for wordpress.org

commit ee69ec404ec2832d9af8c0605b538032177b7a2f
Author: dmsnell <dmsnell@git.wordpress.org>
Date:   Wed Sep 11 14:47:20 2024 +0000

    WP_Debug_Data: Extract `wp-mu-plugins` data into separate method.

    This is the part five in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other.

    This patch separates the fifth of twelve groups, the `wp-mu-plugins` info, into a separate method focused on that data.

    This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code.

    Developed in https://github.com/wordpress/wordpress-develop/7305
    Discussed in https://core.trac.wordpress.org/ticket/61648

    Props apermo, dmsnell.
    See #61648.


    Built from https://develop.svn.wordpress.org/trunk@59011


    git-svn-id: http://core.svn.wordpress.org/trunk@58407 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php
index 3bb2980a25..9bac6905f7 100644
--- a/wp-admin/includes/class-wp-debug-data.php
+++ b/wp-admin/includes/class-wp-debug-data.php
@@ -81,7 +81,7 @@ class WP_Debug_Data {
 			'wp-active-theme'     => array(),
 			'wp-parent-theme'     => array(),
 			'wp-themes-inactive'  => array(),
-			'wp-mu-plugins'       => array(),
+			'wp-mu-plugins'       => self::get_wp_mu_plugins(),
 			'wp-plugins-active'   => array(),
 			'wp-plugins-inactive' => array(),
 			'wp-media'            => array(),
@@ -199,12 +199,6 @@ class WP_Debug_Data {
 			'fields'     => array(),
 		);

-		$info['wp-mu-plugins'] = array(
-			'label'      => __( 'Must Use Plugins' ),
-			'show_count' => true,
-			'fields'     => array(),
-		);
-
 		$info['wp-plugins-active'] = array(
 			'label'      => __( 'Active Plugins' ),
 			'show_count' => true,
@@ -540,41 +534,6 @@ class WP_Debug_Data {
 			'debug' => $gs_debug,
 		);

-		// List must use plugins if there are any.
-		$mu_plugins = get_mu_plugins();
-
-		foreach ( $mu_plugins as $plugin_path => $plugin ) {
-			$plugin_version = $plugin['Version'];
-			$plugin_author  = $plugin['Author'];
-
-			$plugin_version_string       = __( 'No version or author information is available.' );
-			$plugin_version_string_debug = 'author: (undefined), version: (undefined)';
-
-			if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
-				/* translators: 1: Plugin version number. 2: Plugin author name. */
-				$plugin_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
-				$plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author );
-			} else {
-				if ( ! empty( $plugin_author ) ) {
-					/* translators: %s: Plugin author name. */
-					$plugin_version_string       = sprintf( __( 'By %s' ), $plugin_author );
-					$plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author );
-				}
-
-				if ( ! empty( $plugin_version ) ) {
-					/* translators: %s: Plugin version number. */
-					$plugin_version_string       = sprintf( __( 'Version %s' ), $plugin_version );
-					$plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version );
-				}
-			}
-
-			$info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
-				'label' => $plugin['Name'],
-				'value' => $plugin_version_string,
-				'debug' => $plugin_version_string_debug,
-			);
-		}
-
 		// List all available plugins.
 		$plugins        = get_plugins();
 		$plugin_updates = get_plugin_updates();
@@ -1257,6 +1216,57 @@ class WP_Debug_Data {
 		);
 	}

+	/**
+	 * Gets the WordPress plugins section of the debug data.
+	 *
+	 * @since 6.7.0
+	 *
+	 * @return array
+	 */
+	public static function get_wp_mu_plugins(): array {
+		// List must use plugins if there are any.
+		$mu_plugins = get_mu_plugins();
+		$fields = array();
+
+		foreach ( $mu_plugins as $plugin_path => $plugin ) {
+			$plugin_version = $plugin['Version'];
+			$plugin_author  = $plugin['Author'];
+
+			$plugin_version_string       = __( 'No version or author information is available.' );
+			$plugin_version_string_debug = 'author: (undefined), version: (undefined)';
+
+			if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
+				/* translators: 1: Plugin version number. 2: Plugin author name. */
+				$plugin_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
+				$plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author );
+			} else {
+				if ( ! empty( $plugin_author ) ) {
+					/* translators: %s: Plugin author name. */
+					$plugin_version_string       = sprintf( __( 'By %s' ), $plugin_author );
+					$plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author );
+				}
+
+				if ( ! empty( $plugin_version ) ) {
+					/* translators: %s: Plugin version number. */
+					$plugin_version_string       = sprintf( __( 'Version %s' ), $plugin_version );
+					$plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version );
+				}
+			}
+
+			$fields[ sanitize_text_field( $plugin['Name'] ) ] = array(
+				'label' => $plugin['Name'],
+				'value' => $plugin_version_string,
+				'debug' => $plugin_version_string_debug,
+			);
+		}
+
+		return array(
+			'label'      => __( 'Must Use Plugins' ),
+			'show_count' => true,
+			'fields'     => $fields,
+		);
+	}
+
 	/**
 	 * Gets the WordPress constants section of the debug data.
 	 *
diff --git a/wp-includes/version.php b/wp-includes/version.php
index ea964e6761..3d19edc6d7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '6.7-alpha-59010';
+$wp_version = '6.7-alpha-59011';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.