diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 3a2d3a69f8..1f7ad199d6 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1646,6 +1646,7 @@ function wp_dashboard_php_nag() { '; } + +/** + * Gets the URL for directly updating the PHP version the site is running on. + * + * A URL will only be returned if the `WP_DIRECT_UPDATE_PHP_URL` environment variable is specified or + * by using the {@see 'wp_direct_php_update_url'} filter. This allows hosts to send users directly to + * the page where they can update PHP to a newer version. + * + * @return string URL for directly updating PHP or empty string. + */ +function wp_get_direct_php_update_url() { + $direct_update_url = ''; + + if ( false !== getenv( 'WP_DIRECT_UPDATE_PHP_URL' ) ) { + $direct_update_url = getenv( 'WP_DIRECT_UPDATE_PHP_URL' ); + } + + /** + * Filters the URL for directly updating the PHP version the site is running on from the host. + * + * @since 5.1.1 + * + * @param string $direct_update_url URL for directly updating PHP. + */ + $direct_update_url = apply_filters( 'wp_direct_php_update_url', $direct_update_url ); + + return $direct_update_url; +} + +/** + * Display a button directly linking to a PHP update process. + * + * This provides hosts with a way for users to be sent directly to their PHP update process. + * + * The button is only displayed if a URL is returned by `wp_get_direct_php_update_url()`. + * + * @since 5.1.1 + */ +function wp_direct_php_update_button() { + $direct_update_url = wp_get_direct_php_update_url(); + + if ( empty( $direct_update_url ) ) { + return; + } + + echo '
'; +} diff --git a/wp-includes/version.php b/wp-includes/version.php index fe9785c8c5..ae84e69dab 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1.1-alpha-44807'; +$wp_version = '5.1.1-alpha-44815'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.