Changeset 44735
- Timestamp:
- 02/08/2019 01:52:17 AM (6 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/about.php
r44734 r44735 89 89 90 90 <div class="feature-section one-col cta"> 91 <?php if ( true ) : ?> 91 <?php 92 $response = wp_check_php_version(); 93 if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable'] && current_user_can( 'update_php' ) ) : 94 ?> 92 95 <p><em><?php _e( 'WordPress has detected your site is running an outdated version of PHP. You will see this notice on your dashboard with instructions for contacting your host.' ); ?></em></p> 93 96 <?php endif; ?> -
trunk/src/wp-admin/includes/dashboard.php
r44627 r44735 1665 1665 1666 1666 return $classes; 1667 }1668 1669 /**1670 * Checks if the user needs to update PHP.1671 *1672 * @since 5.1.01673 *1674 * @return array|false $response Array of PHP version data. False on failure.1675 */1676 function wp_check_php_version() {1677 $version = phpversion();1678 $key = md5( $version );1679 1680 $response = get_site_transient( 'php_check_' . $key );1681 if ( false === $response ) {1682 $url = 'http://api.wordpress.org/core/serve-happy/1.0/';1683 if ( wp_http_supports( array( 'ssl' ) ) ) {1684 $url = set_url_scheme( $url, 'https' );1685 }1686 1687 $url = add_query_arg( 'php_version', $version, $url );1688 1689 $response = wp_remote_get( $url );1690 1691 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {1692 return false;1693 }1694 1695 /**1696 * Response should be an array with:1697 * 'recommended_version' - string - The PHP version recommended by WordPress.1698 * 'is_supported' - boolean - Whether the PHP version is actively supported.1699 * 'is_secure' - boolean - Whether the PHP version receives security updates.1700 * 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress.1701 */1702 $response = json_decode( wp_remote_retrieve_body( $response ), true );1703 1704 if ( ! is_array( $response ) ) {1705 return false;1706 }1707 1708 set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );1709 }1710 1711 return $response;1712 1667 } 1713 1668 -
trunk/src/wp-admin/includes/misc.php
r44667 r44735 2012 2012 } 2013 2013 } 2014 2015 /** 2016 * Checks if the user needs to update PHP. 2017 * 2018 * @since 5.1.0 2019 * 2020 * @return array|false $response Array of PHP version data. False on failure. 2021 */ 2022 function wp_check_php_version() { 2023 $version = phpversion(); 2024 $key = md5( $version ); 2025 2026 $response = get_site_transient( 'php_check_' . $key ); 2027 if ( false === $response ) { 2028 $url = 'http://api.wordpress.org/core/serve-happy/1.0/'; 2029 if ( wp_http_supports( array( 'ssl' ) ) ) { 2030 $url = set_url_scheme( $url, 'https' ); 2031 } 2032 2033 $url = add_query_arg( 'php_version', $version, $url ); 2034 2035 $response = wp_remote_get( $url ); 2036 2037 if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { 2038 return false; 2039 } 2040 2041 /** 2042 * Response should be an array with: 2043 * 'recommended_version' - string - The PHP version recommended by WordPress. 2044 * 'is_supported' - boolean - Whether the PHP version is actively supported. 2045 * 'is_secure' - boolean - Whether the PHP version receives security updates. 2046 * 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress. 2047 */ 2048 $response = json_decode( wp_remote_retrieve_body( $response ), true ); 2049 2050 if ( ! is_array( $response ) ) { 2051 return false; 2052 } 2053 2054 set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS ); 2055 } 2056 2057 return $response; 2058 }
Note: See TracChangeset
for help on using the changeset viewer.