WP_Debug_Data: Extract `wp-dropins` data into separate method.
This is the seventh part 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 seventh of twelve groups, the `wp-dropins` 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/pull/7418 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo. See #61648. Built from https://develop.svn.wordpress.org/trunk@59100 git-svn-id: http://core.svn.wordpress.org/trunk@58496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ed654177cd
commit
c73731e74e
|
@ -77,7 +77,7 @@ class WP_Debug_Data {
|
|||
$info = array(
|
||||
'wp-core' => array(),
|
||||
'wp-paths-sizes' => array(),
|
||||
'wp-dropins' => array(),
|
||||
'wp-dropins' => self::get_wp_dropins(),
|
||||
'wp-active-theme' => array(),
|
||||
'wp-parent-theme' => array(),
|
||||
'wp-themes-inactive' => array(),
|
||||
|
@ -172,17 +172,6 @@ class WP_Debug_Data {
|
|||
);
|
||||
}
|
||||
|
||||
$info['wp-dropins'] = array(
|
||||
'label' => __( 'Drop-ins' ),
|
||||
'show_count' => true,
|
||||
'description' => sprintf(
|
||||
/* translators: %s: wp-content directory name. */
|
||||
__( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
|
||||
'<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
|
||||
),
|
||||
'fields' => array(),
|
||||
);
|
||||
|
||||
$info['wp-active-theme'] = array(
|
||||
'label' => __( 'Active Theme' ),
|
||||
'fields' => array(),
|
||||
|
@ -336,20 +325,6 @@ class WP_Debug_Data {
|
|||
);
|
||||
}
|
||||
|
||||
// Get a list of all drop-in replacements.
|
||||
$dropins = get_dropins();
|
||||
|
||||
// Get dropins descriptions.
|
||||
$dropin_descriptions = _get_dropins();
|
||||
|
||||
foreach ( $dropins as $dropin_key => $dropin ) {
|
||||
$info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array(
|
||||
'label' => $dropin_key,
|
||||
'value' => $dropin_descriptions[ $dropin_key ][0],
|
||||
'debug' => 'true',
|
||||
);
|
||||
}
|
||||
|
||||
// List all available plugins.
|
||||
$plugins = get_plugins();
|
||||
$plugin_updates = get_plugin_updates();
|
||||
|
@ -840,6 +815,41 @@ class WP_Debug_Data {
|
|||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WordPress drop-in section of the debug data.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_wp_dropins(): array {
|
||||
// Get a list of all drop-in replacements.
|
||||
$dropins = get_dropins();
|
||||
|
||||
// Get drop-ins descriptions.
|
||||
$dropin_descriptions = _get_dropins();
|
||||
|
||||
$fields = array();
|
||||
foreach ( $dropins as $dropin_key => $dropin ) {
|
||||
$fields[ sanitize_text_field( $dropin_key ) ] = array(
|
||||
'label' => $dropin_key,
|
||||
'value' => $dropin_descriptions[ $dropin_key ][0],
|
||||
'debug' => 'true',
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'label' => __( 'Drop-ins' ),
|
||||
'show_count' => true,
|
||||
'description' => sprintf(
|
||||
/* translators: %s: wp-content directory name. */
|
||||
__( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
|
||||
'<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
|
||||
),
|
||||
'fields' => $fields,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WordPress server section of the debug data.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-59099';
|
||||
$wp_version = '6.7-alpha-59100';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue