Make WordPress Core

Ticket #46836: 46836.diff

File 46836.diff, 2.0 KB (added by kraftbj, 5 years ago)
  • src/wp-admin/includes/class-wp-site-health.php

    diff --git src/wp-admin/includes/class-wp-site-health.php src/wp-admin/includes/class-wp-site-health.php
    index 85420f4b8d..aeafa85e6b 100644
    class WP_Site_Health { 
    8787                                unset( $tests['direct']['https_status'] );
    8888                        }
    8989                        foreach ( $tests['direct'] as $test ) {
    90                                 $test_function = sprintf(
    91                                         'get_test_%s',
    92                                         $test['test']
    93                                 );
     90                                if ( is_string( $test['test'] ) ) {
     91                                        $test_function = sprintf(
     92                                                'get_test_%s',
     93                                                $test['test']
     94                                        );
    9495
    95                                 if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) {
    96                                         $health_check_js_variables['site_status']['direct'][] = call_user_func( array( $this, $test_function ) );
    97                                 } else {
     96                                        if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) {
     97                                                $health_check_js_variables['site_status']['direct'][] = call_user_func( array( $this, $test_function ) );
     98                                                continue;
     99                                        }
     100                                }
     101
     102                                if ( is_callable( $test['test'] ) ) {
    98103                                        $health_check_js_variables['site_status']['direct'][] = call_user_func( $test['test'] );
    99104                                }
    100105                        }
    101106
    102107                        foreach ( $tests['async'] as $test ) {
    103                                 $health_check_js_variables['site_status']['async'][] = array(
    104                                         'test'      => $test['test'],
    105                                         'completed' => false,
    106                                 );
     108                                if ( is_string( $test['test'] ) ) {
     109                                        $health_check_js_variables['site_status']['async'][] = array(
     110                                                'test'      => $test['test'],
     111                                                'completed' => false,
     112                                        );
     113                                }
    107114                        }
    108115                }
    109116
    class WP_Site_Health { 
    17831790                 *         to avoid any collisions between tests.
    17841791                 *
    17851792                 *         @type string $label A friendly label for your test to identify it by.
    1786                  *         @type string $test  The ajax action to be called to perform the tests.
     1793                 *         @type mixed  $test  A callable to perform a direct test. A string ajax action to be called to perform an async test.
    17871794                 *     }
    17881795                 * }
    17891796                 */