Skip to content

Commit

Permalink
Refactored WP_Debug_Data::debug_data() Part 1
Browse files Browse the repository at this point in the history
Changed: Moving add_filter calls a distinct function.
Added: 'pre_debug_information' to allow plugin_authors to alter, add, or remove the core debug information callbacks.
  • Loading branch information
apermo committed Jul 21, 2024
1 parent b3fff8f commit f1b1ff4
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/wp-admin/includes/class-wp-debug-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ public static function check_for_updates() {
wp_update_themes();
}

/**
* Add the callbacks to the `debug_information` filter.
*
* Fires on the {@see 'init_admin'} action.
*
* @since tbd
*/
public static function init_filters(): void {
add_filter( 'debug_information', array( __CLASS__, 'wp_filesystem' ), 9 );
}

/**
* Static function for generating site debug data when required.
*
Expand Down Expand Up @@ -1369,7 +1380,16 @@ public static function debug_data(): array {
);
}

add_filter( 'debug_information', array( __CLASS__, 'wp_filesystem' ), 9 );
self::init_filters();

/**
* Fires before the debug information is gathered.
*
* This hook allows you to alter, add, or remove debug information before it is gathered.
*
* @since tbd
*/
do_action( 'pre_debug_information' );

/**
* Filters the debug information shown on the Tools -> Site Health -> Info screen.
Expand Down Expand Up @@ -1438,6 +1458,8 @@ public static function debug_data(): array {

/**
* Populate the file system section of the debug data.
*

Check failure on line 1461 in src/wp-admin/includes/class-wp-debug-data.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Whitespace found at end of line
* Using the {@see 'debug_information'} filter for this.
*
* @since tbd
*
Expand Down

0 comments on commit f1b1ff4

Please sign in to comment.