WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#48105 new enhancement

Move Site Health async checks to a REST API endpoint

Reported by: Clorith Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords:
Focuses: rest-api Cc:
PR Number:

Description

Currently various tests are ran asyncronously with a call to admin-ajax.php, which has some limitations, specifically in core filters not being loaded when using old style ajax calls (see the loopback to wp-admin/site-health.php?health-check-test-wp_version_check to verify the existence of the wp_version_check filter).

Moving things out into REST API endpoints would provide more flexibility, and better handling of permission checks as well. It also means that any code extending tests and adding their own async checks would have a much ore robust platform to test against, if they choose to utilize it.

There's some backwards compatibility considerations to be kept in mind, the current implementation of calling an admin-ajax call needs to be maintained, likely by introducing a has_rest => true flag to the async test registration to decide where to forward the call.

Attachments (1)

48105.patch (12.5 KB) - added by Clorith 2 months ago.

Download all attachments as: .zip

Change History (2)

@Clorith
2 months ago

#1 @Clorith
2 months ago

48105.patch is a first iteration of the above, it retains backwards compatibility for async tests created with admin-ajax.php in mind, but switches to using a REST endpoint if has_rest is defined and set to true.

It also adds failure handling to the async tests, so that if a test fails, it shouldn't break the JS from continuing with the next available check.

There's still some cleaning needed before this is ready (removing references to the old ajax hooks)

Note: See TracTickets for help on using tickets.