mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 19:56:49 +01:00
someday the rest check will work
This commit is contained in:
parent
bbbaa2ba56
commit
6bed85cca4
|
|
@ -136,6 +136,7 @@ $core_actions_post = array(
|
|||
'wp-privacy-erase-personal-data',
|
||||
'health-check-site-status-result',
|
||||
'health-check-dotorg-communication',
|
||||
'health-check-alt-update-api-communication',
|
||||
'health-check-is-in-debug-mode',
|
||||
'health-check-background-updates',
|
||||
'health-check-loopback-requests',
|
||||
|
|
|
|||
|
|
@ -301,6 +301,29 @@ class WP_Debug_Data {
|
|||
'debug' => true
|
||||
);
|
||||
|
||||
if ( WP_UPDATE_API_DEFAULT !== wp_get_update_api_base()) {
|
||||
$wp_update_api = wp_remote_get( wp_get_update_api_base(), array( 'timeout' => 10 ) );
|
||||
|
||||
if ( ! is_wp_error( $wp_update_api ) ) {
|
||||
$fields['alt_update_api_communication'] = array(
|
||||
'label' => __( 'Communication with update API' ),
|
||||
'value' => __( 'Update API is reachable.' ),
|
||||
'debug' => 'true',
|
||||
);
|
||||
} else {
|
||||
$fields['alt_update_api_communication'] = array(
|
||||
'label' => __( 'Communication with update API' ),
|
||||
'value' => sprintf(
|
||||
/* TODO translator note */
|
||||
__('Unable to reach %1$s: %2$s' ),
|
||||
gethostbyname( parse_url( wp_get_update_api_base(), PHP_URL_HOST ) ),
|
||||
$wp_update_api->get_error_message(),
|
||||
),
|
||||
'debug' => $wp_update_api->get_error_message(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'label' => __( 'WordPress' ),
|
||||
'fields' => $fields,
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class WP_REST_Site_Health_Controller extends WP_REST_Controller {
|
|||
'methods' => 'GET',
|
||||
'callback' => array( $this, 'test_alt_update_api_communication' ),
|
||||
'permission_callback' => function() {
|
||||
return $this->validate_request_permission( 'dotorg_communication' );
|
||||
return $this->validate_request_permission( 'alt_update_api_communication' );
|
||||
},
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user