Upgrade/Install: As a follow-up to [45357], when linking to Update PHP support page in error messages, check if `wp_get_update_php_url()` and `wp_get_update_php_annotation()` exist.

`wp-admin/includes/update-core.php` runs in the context of the previous WordPress version. Any calls to newly introduced functions there need to be checked via `function_exists()`.

Reviewed by desrosj, earnjam, SergeyBiryukov.

Props dd32, imath.
Fixes #47323.
Built from https://develop.svn.wordpress.org/trunk@45365


git-svn-id: http://core.svn.wordpress.org/trunk@45176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-05-20 14:29:55 +00:00
parent 460e256026
commit 3b926e0b47
2 changed files with 11 additions and 6 deletions

View File

@ -946,13 +946,18 @@ function update_core( $from, $to ) {
$wp_filesystem->delete( $from, true );
}
$php_update_message = '';
if ( function_exists( 'wp_get_update_php_url' ) ) {
/* translators: %s: Update PHP page URL */
$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) );
if ( function_exists( 'wp_get_update_php_annotation' ) ) {
$annotation = wp_get_update_php_annotation();
if ( $annotation ) {
$php_update_message .= '</p><p><em>' . $annotation . '</em>';
}
}
}
if ( ! $mysql_compat && ! $php_compat ) {
return new WP_Error( 'php_mysql_not_compatible', sprintf( __( 'The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) . $php_update_message );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45363';
$wp_version = '5.3-alpha-45365';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.