Changeset 50072 for trunk/src/wp-admin/includes/class-wp-site-health.php
- Timestamp:
- 01/29/2021 07:09:49 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-site-health.php
r50041 r50072 109 109 // Don't run https test on development environments. 110 110 if ( $this->is_development_environment() ) { 111 unset( $tests[' direct']['https_status'] );111 unset( $tests['async']['https_status'] ); 112 112 } 113 113 … … 1499 1499 */ 1500 1500 public function get_test_https_status() { 1501 // Enforce fresh HTTPS detection results. This is normally invoked by using cron, but for Site Health it should 1502 // always rely on the latest results. 1503 wp_update_https_detection_errors(); 1504 1501 1505 $result = array( 1502 1506 'label' => __( 'Your website is using an active HTTPS connection' ), … … 1522 1526 1523 1527 if ( ! wp_is_using_https() ) { 1528 // If the website is not using HTTPS, provide more information about whether it is supported and how it can 1529 // be enabled. 1524 1530 $result['status'] = 'critical'; 1525 1531 $result['label'] = __( 'Your website does not use HTTPS' ); 1526 1532 1527 if ( is_ssl() ) { 1528 $result['description'] = sprintf( 1529 '<p>%s</p>', 1530 sprintf( 1531 /* translators: %s: URL to General Settings screen. */ 1532 __( 'You are accessing this website using HTTPS, but your <a href="%s">WordPress Address</a> is not set up to use HTTPS by default.' ), 1533 esc_url( admin_url( 'options-general.php' ) ) 1534 ) 1535 ); 1533 if ( wp_is_site_url_using_https() ) { 1534 if ( is_ssl() ) { 1535 $result['description'] = sprintf( 1536 '<p>%s</p>', 1537 sprintf( 1538 /* translators: %s: URL to Settings > General > Site Address. */ 1539 __( 'You are accessing this website using HTTPS, but your <a href="%s">Site Address</a> is not set up to use HTTPS by default.' ), 1540 esc_url( admin_url( 'options-general.php' ) . '#home' ) 1541 ) 1542 ); 1543 } else { 1544 $result['description'] = sprintf( 1545 '<p>%s</p>', 1546 sprintf( 1547 /* translators: %s: URL to Settings > General > Site Address. */ 1548 __( 'Your <a href="%s">Site Address</a> is not set up to use HTTPS.' ), 1549 esc_url( admin_url( 'options-general.php' ) . '#home' ) 1550 ) 1551 ); 1552 } 1536 1553 } else { 1537 $result['description'] = sprintf( 1538 '<p>%s</p>', 1539 sprintf( 1540 /* translators: %s: URL to General Settings screen. */ 1541 __( 'Your <a href="%s">WordPress Address</a> is not set up to use HTTPS.' ), 1542 esc_url( admin_url( 'options-general.php' ) ) 1543 ) 1544 ); 1554 if ( is_ssl() ) { 1555 $result['description'] = sprintf( 1556 '<p>%s</p>', 1557 sprintf( 1558 /* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */ 1559 __( 'You are accessing this website using HTTPS, but your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS by default.' ), 1560 esc_url( admin_url( 'options-general.php' ) . '#siteurl' ), 1561 esc_url( admin_url( 'options-general.php' ) . '#home' ) 1562 ) 1563 ); 1564 } else { 1565 $result['description'] = sprintf( 1566 '<p>%s</p>', 1567 sprintf( 1568 /* translators: 1: URL to Settings > General > WordPress Address, 2: URL to Settings > General > Site Address. */ 1569 __( 'Your <a href="%1$s">WordPress Address</a> and <a href="%2$s">Site Address</a> are not set up to use HTTPS.' ), 1570 esc_url( admin_url( 'options-general.php' ) . '#siteurl' ), 1571 esc_url( admin_url( 'options-general.php' ) . '#home' ) 1572 ) 1573 ); 1574 } 1545 1575 } 1546 1576 … … 1562 1592 ); 1563 1593 } 1594 } elseif ( ! wp_is_https_supported() ) { 1595 // If the website is using HTTPS, but HTTPS is actually not supported, inform the user about the potential 1596 // problems. 1597 $result['status'] = 'critical'; 1598 $result['label'] = __( 'There are problems with the HTTPS connection of your website' ); 1599 1600 $https_detection_errors = get_option( 'https_detection_errors' ); 1601 if ( ! empty( $https_detection_errors['ssl_verification_failed'] ) ) { 1602 $result['description'] = sprintf( 1603 '<p>%s</p>', 1604 sprintf( 1605 /* translators: %s: URL to Settings > General > WordPress Address. */ 1606 __( 'Your <a href="%s">WordPress Address</a> is set up to use HTTPS, but the SSL certificate appears to be invalid.' ), 1607 esc_url( admin_url( 'options-general.php' ) . '#siteurl' ) 1608 ) 1609 ); 1610 } else { 1611 $result['description'] = sprintf( 1612 '<p>%s</p>', 1613 sprintf( 1614 /* translators: %s: URL to Settings > General > WordPress Address. */ 1615 __( 'Your <a href="%s">WordPress Address</a> is set up to use HTTPS, but your website appears to be unavailable when using an HTTPS connection.' ), 1616 esc_url( admin_url( 'options-general.php' ) . '#siteurl' ) 1617 ) 1618 ); 1619 } 1620 $result['description'] .= sprintf( 1621 '<p>%s</p>', 1622 __( 'Talk to your web host about resolving this HTTPS issue for your website.' ) 1623 ); 1564 1624 } 1565 1625 … … 2201 2261 'test' => 'utf8mb4_support', 2202 2262 ), 2203 'https_status' => array(2204 'label' => __( 'HTTPS status' ),2205 'test' => 'https_status',2206 ),2207 2263 'ssl_support' => array( 2208 2264 'label' => __( 'Secure communication' ), … … 2248 2304 'has_rest' => true, 2249 2305 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_loopback_requests' ), 2306 ), 2307 'https_status' => array( 2308 'label' => __( 'HTTPS status' ), 2309 'test' => rest_url( 'wp-site-health/v1/tests/https-status' ), 2310 'has_rest' => true, 2311 'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_https_status' ), 2250 2312 ), 2251 2313 'authorization_header' => array( … … 2615 2677 // Don't run https test on development environments. 2616 2678 if ( $this->is_development_environment() ) { 2617 unset( $tests[' direct']['https_status'] );2679 unset( $tests['async']['https_status'] ); 2618 2680 } 2619 2681
Note: See TracChangeset
for help on using the changeset viewer.