@@ -56,7 +56,7 @@ public static function debug_data() {
56
56
*/
57
57
$ info = array (
58
58
'wp-core ' => self ::get_wp_core (),
59
- 'wp-paths-sizes ' => array (),
59
+ 'wp-paths-sizes ' => self :: get_wp_paths_sizes (),
60
60
'wp-dropins ' => self ::get_wp_dropins (),
61
61
'wp-active-theme ' => array (),
62
62
'wp-parent-theme ' => array (),
@@ -71,18 +71,17 @@ public static function debug_data() {
71
71
'wp-filesystem ' => self ::get_wp_filesystem (),
72
72
);
73
73
74
- // Remove debug data which is only relevant on single-site installs.
75
- if ( is_multisite () ) {
76
- unset( $ info ['wp-paths-sizes ' ] );
77
- }
78
-
79
- if ( ! $ is_multisite ) {
80
- $ info ['wp-paths-sizes ' ] = array (
81
- /* translators: Filesystem directory paths and storage sizes. */
82
- 'label ' => __ ( 'Directories and Sizes ' ),
83
- 'fields ' => array (),
84
- );
85
- }
74
+ /*
75
+ * Remove null elements from the array. The individual methods are
76
+ * allowed to return `null`, which communicates that the category
77
+ * of debug data isn't relevant and shouldn't be passed through.
78
+ */
79
+ $ info = array_filter (
80
+ $ info ,
81
+ static function ( $ section ) {
82
+ return isset ( $ section );
83
+ }
84
+ );
86
85
87
86
$ info ['wp-active-theme ' ] = array (
88
87
'label ' => __ ( 'Active Theme ' ),
@@ -100,69 +99,6 @@ public static function debug_data() {
100
99
'fields ' => array (),
101
100
);
102
101
103
- // Remove accordion for Directories and Sizes if in Multisite.
104
- if ( ! $ is_multisite ) {
105
- $ loading = __ ( 'Loading… ' );
106
-
107
- $ info ['wp-paths-sizes ' ]['fields ' ] = array (
108
- 'wordpress_path ' => array (
109
- 'label ' => __ ( 'WordPress directory location ' ),
110
- 'value ' => untrailingslashit ( ABSPATH ),
111
- ),
112
- 'wordpress_size ' => array (
113
- 'label ' => __ ( 'WordPress directory size ' ),
114
- 'value ' => $ loading ,
115
- 'debug ' => 'loading... ' ,
116
- ),
117
- 'uploads_path ' => array (
118
- 'label ' => __ ( 'Uploads directory location ' ),
119
- 'value ' => $ upload_dir ['basedir ' ],
120
- ),
121
- 'uploads_size ' => array (
122
- 'label ' => __ ( 'Uploads directory size ' ),
123
- 'value ' => $ loading ,
124
- 'debug ' => 'loading... ' ,
125
- ),
126
- 'themes_path ' => array (
127
- 'label ' => __ ( 'Themes directory location ' ),
128
- 'value ' => get_theme_root (),
129
- ),
130
- 'themes_size ' => array (
131
- 'label ' => __ ( 'Themes directory size ' ),
132
- 'value ' => $ loading ,
133
- 'debug ' => 'loading... ' ,
134
- ),
135
- 'plugins_path ' => array (
136
- 'label ' => __ ( 'Plugins directory location ' ),
137
- 'value ' => WP_PLUGIN_DIR ,
138
- ),
139
- 'plugins_size ' => array (
140
- 'label ' => __ ( 'Plugins directory size ' ),
141
- 'value ' => $ loading ,
142
- 'debug ' => 'loading... ' ,
143
- ),
144
- 'fonts_path ' => array (
145
- 'label ' => __ ( 'Fonts directory location ' ),
146
- 'value ' => wp_get_font_dir ()['basedir ' ],
147
- ),
148
- 'fonts_size ' => array (
149
- 'label ' => __ ( 'Fonts directory size ' ),
150
- 'value ' => $ loading ,
151
- 'debug ' => 'loading... ' ,
152
- ),
153
- 'database_size ' => array (
154
- 'label ' => __ ( 'Database size ' ),
155
- 'value ' => $ loading ,
156
- 'debug ' => 'loading... ' ,
157
- ),
158
- 'total_size ' => array (
159
- 'label ' => __ ( 'Total installation size ' ),
160
- 'value ' => $ loading ,
161
- 'debug ' => 'loading... ' ,
162
- ),
163
- );
164
- }
165
-
166
102
// Populate the section for the currently active theme.
167
103
$ theme_features = array ();
168
104
@@ -1133,7 +1069,7 @@ private static function get_wp_media(): array {
1133
1069
1134
1070
1135
1071
/**
1136
- * Gets the WordPress plugins section of the debug data.
1072
+ * Gets the WordPress MU plugins section of the debug data.
1137
1073
*
1138
1074
* @since 6.7.0
1139
1075
*
@@ -1183,6 +1119,86 @@ private static function get_wp_mu_plugins(): array {
1183
1119
);
1184
1120
}
1185
1121
1122
+ /**
1123
+ * Gets the WordPress paths and sizes section of the debug data.
1124
+ *
1125
+ * @since 6.7.0
1126
+ *
1127
+ * @return array|null Paths and sizes debug data for single sites,
1128
+ * otherwise `null` for multi-site installs.
1129
+ */
1130
+ private static function get_wp_paths_sizes (): ?array {
1131
+ if ( is_multisite () ) {
1132
+ return null ;
1133
+ }
1134
+
1135
+ $ loading = __ ( 'Loading… ' );
1136
+
1137
+ $ fields = array (
1138
+ 'wordpress_path ' => array (
1139
+ 'label ' => __ ( 'WordPress directory location ' ),
1140
+ 'value ' => untrailingslashit ( ABSPATH ),
1141
+ ),
1142
+ 'wordpress_size ' => array (
1143
+ 'label ' => __ ( 'WordPress directory size ' ),
1144
+ 'value ' => $ loading ,
1145
+ 'debug ' => 'loading... ' ,
1146
+ ),
1147
+ 'uploads_path ' => array (
1148
+ 'label ' => __ ( 'Uploads directory location ' ),
1149
+ 'value ' => wp_upload_dir ()['basedir ' ],
1150
+ ),
1151
+ 'uploads_size ' => array (
1152
+ 'label ' => __ ( 'Uploads directory size ' ),
1153
+ 'value ' => $ loading ,
1154
+ 'debug ' => 'loading... ' ,
1155
+ ),
1156
+ 'themes_path ' => array (
1157
+ 'label ' => __ ( 'Themes directory location ' ),
1158
+ 'value ' => get_theme_root (),
1159
+ ),
1160
+ 'themes_size ' => array (
1161
+ 'label ' => __ ( 'Themes directory size ' ),
1162
+ 'value ' => $ loading ,
1163
+ 'debug ' => 'loading... ' ,
1164
+ ),
1165
+ 'plugins_path ' => array (
1166
+ 'label ' => __ ( 'Plugins directory location ' ),
1167
+ 'value ' => WP_PLUGIN_DIR ,
1168
+ ),
1169
+ 'plugins_size ' => array (
1170
+ 'label ' => __ ( 'Plugins directory size ' ),
1171
+ 'value ' => $ loading ,
1172
+ 'debug ' => 'loading... ' ,
1173
+ ),
1174
+ 'fonts_path ' => array (
1175
+ 'label ' => __ ( 'Fonts directory location ' ),
1176
+ 'value ' => wp_get_font_dir ()['basedir ' ],
1177
+ ),
1178
+ 'fonts_size ' => array (
1179
+ 'label ' => __ ( 'Fonts directory size ' ),
1180
+ 'value ' => $ loading ,
1181
+ 'debug ' => 'loading... ' ,
1182
+ ),
1183
+ 'database_size ' => array (
1184
+ 'label ' => __ ( 'Database size ' ),
1185
+ 'value ' => $ loading ,
1186
+ 'debug ' => 'loading... ' ,
1187
+ ),
1188
+ 'total_size ' => array (
1189
+ 'label ' => __ ( 'Total installation size ' ),
1190
+ 'value ' => $ loading ,
1191
+ 'debug ' => 'loading... ' ,
1192
+ ),
1193
+ );
1194
+
1195
+ return array (
1196
+ /* translators: Filesystem directory paths and storage sizes. */
1197
+ 'label ' => __ ( 'Directories and Sizes ' ),
1198
+ 'fields ' => $ fields ,
1199
+ );
1200
+ }
1201
+
1186
1202
/**
1187
1203
* Gets the WordPress active plugins section of the debug data.
1188
1204
*
0 commit comments