Make WordPress Core


Ignore:
Timestamp:
10/15/2020 01:58:28 AM (4 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-admin/includes/ajax-actions.php

    r49122 r49154  
    51435143 *
    51445144 * @since 5.2.0
     5145 * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_dotorg_communication()
     5146 * @see WP_REST_Site_Health_Controller::test_dotorg_communication()
    51455147 */
    51465148function wp_ajax_health_check_dotorg_communication() {
     5149    _doing_it_wrong(
     5150        'wp_ajax_health_check_dotorg_communication',
     5151        sprintf(
     5152        // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
     5153            __( 'The Site Health check for %1$s has been replaced with %2$s.' ),
     5154            'wp_ajax_health_check_dotorg_communication',
     5155            'WP_REST_Site_Health_Controller::test_dotorg_communication'
     5156        ),
     5157        '5.6.0'
     5158    );
     5159
    51475160    check_ajax_referer( 'health-check-site-status' );
    51485161
     
    51635176 *
    51645177 * @since 5.2.0
     5178 * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_background_updates()
     5179 * @see WP_REST_Site_Health_Controller::test_background_updates()
    51655180 */
    51665181function wp_ajax_health_check_background_updates() {
     5182    _doing_it_wrong(
     5183        'wp_ajax_health_check_background_updates',
     5184        sprintf(
     5185        // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
     5186            __( 'The Site Health check for %1$s has been replaced with %2$s.' ),
     5187            'wp_ajax_health_check_background_updates',
     5188            'WP_REST_Site_Health_Controller::test_background_updates'
     5189        ),
     5190        '5.6.0'
     5191    );
     5192
    51675193    check_ajax_referer( 'health-check-site-status' );
    51685194
     
    51835209 *
    51845210 * @since 5.2.0
     5211 * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_loopback_requests()
     5212 * @see WP_REST_Site_Health_Controller::test_loopback_requests()
    51855213 */
    51865214function wp_ajax_health_check_loopback_requests() {
     5215    _doing_it_wrong(
     5216        'wp_ajax_health_check_loopback_requests',
     5217        sprintf(
     5218        // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
     5219            __( 'The Site Health check for %1$s has been replaced with %2$s.' ),
     5220            'wp_ajax_health_check_loopback_requests',
     5221            'WP_REST_Site_Health_Controller::test_loopback_requests'
     5222        ),
     5223        '5.6.0'
     5224    );
     5225
    51875226    check_ajax_referer( 'health-check-site-status' );
    51885227
     
    52205259 *
    52215260 * @since 5.2.0
     5261 * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::get_directory_sizes()
     5262 * @see WP_REST_Site_Health_Controller::get_directory_sizes()
    52225263 */
    52235264function wp_ajax_health_check_get_sizes() {
     5265    _doing_it_wrong(
     5266        'wp_ajax_health_check_get_sizes',
     5267        sprintf(
     5268        // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
     5269            __( 'The Site Health check for %1$s has been replaced with %2$s.' ),
     5270            'wp_ajax_health_check_get_sizes',
     5271            'WP_REST_Site_Health_Controller::get_directory_sizes'
     5272        ),
     5273        '5.6.0'
     5274    );
     5275
    52245276    check_ajax_referer( 'health-check-site-status-result' );
    52255277
Note: See TracChangeset for help on using the changeset viewer.