mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
WP_Debug_Data: Extract wp-paths-sizes
data into separate methods.
This is the tenth 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 eleventh of twelve groups, the `wp-paths-sizes` 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/7445 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell. See #61648. Built from https://develop.svn.wordpress.org/trunk@59175 git-svn-id: http://core.svn.wordpress.org/trunk@58570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
761869935d
commit
f2282f68c0
@ -56,7 +56,7 @@ class WP_Debug_Data {
|
||||
*/
|
||||
$info = array(
|
||||
'wp-core' => self::get_wp_core(),
|
||||
'wp-paths-sizes' => array(),
|
||||
'wp-paths-sizes' => self::get_wp_paths_sizes(),
|
||||
'wp-dropins' => self::get_wp_dropins(),
|
||||
'wp-active-theme' => array(),
|
||||
'wp-parent-theme' => array(),
|
||||
@ -71,18 +71,17 @@ class WP_Debug_Data {
|
||||
'wp-filesystem' => self::get_wp_filesystem(),
|
||||
);
|
||||
|
||||
// Remove debug data which is only relevant on single-site installs.
|
||||
if ( is_multisite() ) {
|
||||
unset( $info['wp-paths-sizes'] );
|
||||
}
|
||||
|
||||
if ( ! $is_multisite ) {
|
||||
$info['wp-paths-sizes'] = array(
|
||||
/* translators: Filesystem directory paths and storage sizes. */
|
||||
'label' => __( 'Directories and Sizes' ),
|
||||
'fields' => array(),
|
||||
);
|
||||
}
|
||||
/*
|
||||
* Remove null elements from the array. The individual methods are
|
||||
* allowed to return `null`, which communicates that the category
|
||||
* of debug data isn't relevant and shouldn't be passed through.
|
||||
*/
|
||||
$info = array_filter(
|
||||
$info,
|
||||
static function ( $section ) {
|
||||
return isset( $section );
|
||||
}
|
||||
);
|
||||
|
||||
$info['wp-active-theme'] = array(
|
||||
'label' => __( 'Active Theme' ),
|
||||
@ -100,69 +99,6 @@ class WP_Debug_Data {
|
||||
'fields' => array(),
|
||||
);
|
||||
|
||||
// Remove accordion for Directories and Sizes if in Multisite.
|
||||
if ( ! $is_multisite ) {
|
||||
$loading = __( 'Loading…' );
|
||||
|
||||
$info['wp-paths-sizes']['fields'] = array(
|
||||
'wordpress_path' => array(
|
||||
'label' => __( 'WordPress directory location' ),
|
||||
'value' => untrailingslashit( ABSPATH ),
|
||||
),
|
||||
'wordpress_size' => array(
|
||||
'label' => __( 'WordPress directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'uploads_path' => array(
|
||||
'label' => __( 'Uploads directory location' ),
|
||||
'value' => $upload_dir['basedir'],
|
||||
),
|
||||
'uploads_size' => array(
|
||||
'label' => __( 'Uploads directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'themes_path' => array(
|
||||
'label' => __( 'Themes directory location' ),
|
||||
'value' => get_theme_root(),
|
||||
),
|
||||
'themes_size' => array(
|
||||
'label' => __( 'Themes directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'plugins_path' => array(
|
||||
'label' => __( 'Plugins directory location' ),
|
||||
'value' => WP_PLUGIN_DIR,
|
||||
),
|
||||
'plugins_size' => array(
|
||||
'label' => __( 'Plugins directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'fonts_path' => array(
|
||||
'label' => __( 'Fonts directory location' ),
|
||||
'value' => wp_get_font_dir()['basedir'],
|
||||
),
|
||||
'fonts_size' => array(
|
||||
'label' => __( 'Fonts directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'database_size' => array(
|
||||
'label' => __( 'Database size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'total_size' => array(
|
||||
'label' => __( 'Total installation size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Populate the section for the currently active theme.
|
||||
$theme_features = array();
|
||||
|
||||
@ -1133,7 +1069,7 @@ class WP_Debug_Data {
|
||||
|
||||
|
||||
/**
|
||||
* Gets the WordPress plugins section of the debug data.
|
||||
* Gets the WordPress MU plugins section of the debug data.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
@ -1183,6 +1119,86 @@ class WP_Debug_Data {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WordPress paths and sizes section of the debug data.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @return array|null Paths and sizes debug data for single sites,
|
||||
* otherwise `null` for multi-site installs.
|
||||
*/
|
||||
private static function get_wp_paths_sizes(): ?array {
|
||||
if ( is_multisite() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$loading = __( 'Loading…' );
|
||||
|
||||
$fields = array(
|
||||
'wordpress_path' => array(
|
||||
'label' => __( 'WordPress directory location' ),
|
||||
'value' => untrailingslashit( ABSPATH ),
|
||||
),
|
||||
'wordpress_size' => array(
|
||||
'label' => __( 'WordPress directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'uploads_path' => array(
|
||||
'label' => __( 'Uploads directory location' ),
|
||||
'value' => wp_upload_dir()['basedir'],
|
||||
),
|
||||
'uploads_size' => array(
|
||||
'label' => __( 'Uploads directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'themes_path' => array(
|
||||
'label' => __( 'Themes directory location' ),
|
||||
'value' => get_theme_root(),
|
||||
),
|
||||
'themes_size' => array(
|
||||
'label' => __( 'Themes directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'plugins_path' => array(
|
||||
'label' => __( 'Plugins directory location' ),
|
||||
'value' => WP_PLUGIN_DIR,
|
||||
),
|
||||
'plugins_size' => array(
|
||||
'label' => __( 'Plugins directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'fonts_path' => array(
|
||||
'label' => __( 'Fonts directory location' ),
|
||||
'value' => wp_get_font_dir()['basedir'],
|
||||
),
|
||||
'fonts_size' => array(
|
||||
'label' => __( 'Fonts directory size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'database_size' => array(
|
||||
'label' => __( 'Database size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
'total_size' => array(
|
||||
'label' => __( 'Total installation size' ),
|
||||
'value' => $loading,
|
||||
'debug' => 'loading...',
|
||||
),
|
||||
);
|
||||
|
||||
return array(
|
||||
/* translators: Filesystem directory paths and storage sizes. */
|
||||
'label' => __( 'Directories and Sizes' ),
|
||||
'fields' => $fields,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WordPress active plugins section of the debug data.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-beta1-59174';
|
||||
$wp_version = '6.7-beta1-59175';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user