Make WordPress Core


Ignore:
Timestamp:
10/15/2020 01:58:28 AM (5 years ago)
Author:
TimothyBlynJacobs
Message:

Site Health, REST API: Move async tests to REST API endpoints.

This provides more flexibility when writing tests and benefits from running in a front-end context which is necessary for some tests like checking that updates are supported. Additionally, this provides a more robust interface for developers who want to integrate with Site Health tests.

Because the wp/v2 endpoint is reserved for modeling core entities, site health is registered in its own wp-site-health/v1 namespace.

The existing ajax actions have been maintained for backward compatibility.

Props Clorith, chrisvanpatten, afragen, pokhriyal, TimothyBlynJacobs.
Fixes #48105.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r49132 r49154  
    316316    // Block Directory.
    317317    $controller = new WP_REST_Block_Directory_Controller();
     318    $controller->register_routes();
     319
     320    // Site Health
     321    $site_health = WP_Site_Health::get_instance();
     322    $controller = new WP_REST_Site_Health_Controller( $site_health );
    318323    $controller->register_routes();
    319324}
Note: See TracChangeset for help on using the changeset viewer.