Skip to content

Commit af239ae

Browse files
committed
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 #7289 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell, sergeybiryukov. See #61648. git-svn-id: https://develop.svn.wordpress.org/trunk@58996 602fd350-edb4-49c9-b593-d223f7449a82
1 parent da1ea40 commit af239ae

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,35 @@ public static function debug_data() {
6161
}
6262
}
6363

64-
// Set up the array that holds all debug information.
65-
$info = array();
64+
/*
65+
* Set up the array that holds all debug information.
66+
*
67+
* When iterating through the debug data, the ordering of the sections
68+
* occurs in insertion-order of the assignments into this array. Setting
69+
* up empty values here preserves that specific ordering so it doesn't
70+
* depend on when inside this method each section is otherwise assigned.
71+
*
72+
* When all sections have been modularized, this will be the final single
73+
* assignment of the sections before filtering and none will be empty.
74+
*
75+
* @ticket 61648
76+
*/
77+
$info = array(
78+
'wp-core' => array(),
79+
'wp-paths-sizes' => array(),
80+
'wp-dropins' => array(),
81+
'wp-active-theme' => array(),
82+
'wp-parent-theme' => array(),
83+
'wp-themes-inactive' => array(),
84+
'wp-mu-plugins' => array(),
85+
'wp-plugins-active' => array(),
86+
'wp-plugins-inactive' => array(),
87+
'wp-media' => array(),
88+
'wp-server' => array(),
89+
'wp-database' => self::get_wp_database(),
90+
'wp-constants' => self::get_wp_constants(),
91+
'wp-filesystem' => self::get_wp_filesystem(),
92+
);
6693

6794
$info['wp-core'] = array(
6895
'label' => __( 'WordPress' ),
@@ -1154,10 +1181,6 @@ public static function debug_data() {
11541181
);
11551182
}
11561183

1157-
$info['wp-constants'] = self::get_wp_constants();
1158-
$info['wp-database'] = self::get_wp_database();
1159-
$info['wp-filesystem'] = self::get_wp_filesystem();
1160-
11611184
/**
11621185
* Filters the debug information shown on the Tools -> Site Health -> Info screen.
11631186
*

0 commit comments

Comments
 (0)