WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 13 days ago

#47864 new enhancement

Provide filters for Site Health Check results

Reported by: Clorith Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: has-patch needs-docs commit
Focuses: Cc:

Description

Currently, there's a filter to modify which PHP extensions are checked for, and even which tests to run, but nothing for the actual results.

There are scenarios where someone might want to extend the results, either by providing a more involved description for a given scenario, or maybe even to provide additional actions.

An example might be a hosting provider, PHP extensions are missing, so they add in an action link to the PHP extension manager of their control panel.
Perhaps they wanted to be more direct, they wanted the PHP version check, which recommends the user update, they add in an ajax button that'll switch the PHP version for them on the spot.

Basically, there are many possibilities here, and it would be nice if we offered them up on a nice silver platter.

There is one limitation I'm thinking of though; asynchronous tests.

While direct tests run on the spot, and thus have traditional filters available to them, the asynchronous ones run after the fact via JavaScript. Since we don't have a wrapper for the tests, they rely on whatever added the test creating their own admin-ajax action to capture them.

Are JavaScript filters the way to go for these, or does that create an odd separation between the two?

---

As for the proposed filter it self, using something like apply_filters( 'site_status_test_result', call_user_func( $test['test'] ), $test_key ) is what I'm looking at, where $test_key is the array key given in the WP_Site_Health::get_tests() list of tests, and can then be used as a reference.

Attachments (2)

47864.patch (2.9 KB) - added by Clorith 6 weeks ago.
47864.2.patch (2.8 KB) - added by Clorith 4 weeks ago.

Download all attachments as: .zip

Change History (5)

@Clorith
6 weeks ago

#1 @Clorith
6 weeks ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 5.3

47864.patch adds the filter site_status_test_result both to PHP, and with the same name and output for JavaScript on the asynchronous tests.

I'm not familiar with JS inline docs, and I'm not even sure if they are needed when the filter, and data, are the same, so they are not included here for now.

@Clorith
4 weeks ago

#2 @Clorith
4 weeks ago

  • Keywords needs-docs added

47864.2.patch is essentially the same as the original patch, but uses the existing format for pointing to identical filter declarations in other files.

Tagging with needs-docs for now, as I'm not sure if this is the right approach for cross-language filters, as our JS inline docs standard don't currently include filter and action pointers.

#3 @Clorith
13 days ago

  • Keywords commit added

Moving this forward, I'd like to see this land, the inline-docs for the JavaScript filter can be added on as we go along if the current approach in 47864.2.patch is lacking.

Note: See TracTickets for help on using tickets.