- Timestamp:
- 10/15/2020 01:58:28 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-site-health-auto-updates.php
r48792 r49154 91 91 */ 92 92 public function test_wp_version_check_attached() { 93 if ( ! is_main_site() ) { 94 return; 95 } 96 97 $cookies = wp_unslash( $_COOKIE ); 98 $timeout = 10; 99 $headers = array( 100 'Cache-Control' => 'no-cache', 101 ); 102 /** This filter is documented in wp-includes/class-wp-http-streams.php */ 103 $sslverify = apply_filters( 'https_local_ssl_verify', false ); 104 105 // Include Basic auth in loopback requests. 106 if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { 107 $headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) ); 108 } 109 110 $url = add_query_arg( 111 array( 112 'health-check-test-wp_version_check' => true, 113 ), 114 admin_url( 'site-health.php' ) 115 ); 116 117 $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); 118 119 if ( is_wp_error( $test ) ) { 120 return array( 121 'description' => sprintf( 122 /* translators: %s: Name of the filter used. */ 123 __( 'Could not confirm that the %s filter is available.' ), 124 '<code>wp_version_check()</code>' 125 ), 126 'severity' => 'warning', 127 ); 128 } 129 130 $response = wp_remote_retrieve_body( $test ); 131 132 if ( 'yes' !== $response ) { 93 if ( ! has_filter( 'wp_version_check', 'wp_version_check' ) ) { 133 94 return array( 134 95 'description' => sprintf( … … 311 272 */ 312 273 function test_check_wp_filesystem_method() { 274 // Make sure the `request_filesystem_credentials` function is available during our REST call. 275 if ( ! function_exists( 'request_filesystem_credentials' ) ) { 276 require_once ABSPATH . '/wp-admin/includes/file.php'; 277 } 278 313 279 $skin = new Automatic_Upgrader_Skin; 314 280 $success = $skin->request_filesystem_credentials( false, ABSPATH ); … … 355 321 if ( 'direct' !== $wp_filesystem->method ) { 356 322 return false; 323 } 324 325 // Make sure the `get_core_checksums` function is available during our REST call. 326 if ( ! function_exists( 'get_core_checksums' ) ) { 327 require_once ABSPATH . '/wp-admin/includes/update.php'; 357 328 } 358 329
Note: See TracChangeset
for help on using the changeset viewer.