Debug Data: Encode section ordering in debug info.

During a refactor to modularize the debug data class, it came up that the ordering of the sections inside of the returned debug info is relevant to existing UIs, as they iterate the array, which happens in insertion order.

This patch presets each section at the start to ensure that the ordering remains consistent even as code within the method is rearranged. As the mini-project progresses, this assignment will be the final place all the sections are referenced.

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

Props apermo, dmsnell, sergeybiryukov.
See #61648.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-09-06 19:50:19 +00:00
parent c311a9de36
commit 76c06eb274
2 changed files with 30 additions and 7 deletions

View File

@ -61,8 +61,35 @@ class WP_Debug_Data {
}
}
// Set up the array that holds all debug information.
$info = array();
/*
* Set up the array that holds all debug information.
*
* When iterating through the debug data, the ordering of the sections
* occurs in insertion-order of the assignments into this array. Setting
* up empty values here preserves that specific ordering so it doesn't
* depend on when inside this method each section is otherwise assigned.
*
* When all sections have been modularized, this will be the final single
* assignment of the sections before filtering and none will be empty.
*
* @ticket 61648
*/
$info = array(
'wp-core' => array(),
'wp-paths-sizes' => array(),
'wp-dropins' => array(),
'wp-active-theme' => array(),
'wp-parent-theme' => array(),
'wp-themes-inactive' => array(),
'wp-mu-plugins' => array(),
'wp-plugins-active' => array(),
'wp-plugins-inactive' => array(),
'wp-media' => array(),
'wp-server' => array(),
'wp-database' => self::get_wp_database(),
'wp-constants' => self::get_wp_constants(),
'wp-filesystem' => self::get_wp_filesystem(),
);
$info['wp-core'] = array(
'label' => __( 'WordPress' ),
@ -1154,10 +1181,6 @@ class WP_Debug_Data {
);
}
$info['wp-constants'] = self::get_wp_constants();
$info['wp-database'] = self::get_wp_database();
$info['wp-filesystem'] = self::get_wp_filesystem();
/**
* Filters the debug information shown on the Tools -> Site Health -> Info screen.
*

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58995';
$wp_version = '6.7-alpha-58996';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.