From 22d61857fc3e42d3f85d7b0947c1c77843587233 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 20 Mar 2019 14:59:50 +0000 Subject: [PATCH] Plugins: Block plugin updates on the update screen if required PHP version is not supported. This brings the changes in [44937] to the WordPress Updates page in the admin. Now, when a site does not meet the minimum PHP version requirements for a plugin update, the user will not be able to update. Instead, they will be presented with educational information to guide them through the process of updating PHP. Props afragen, miyauchi, TimothyBlynJacobs, desrosj. Fixes #44350. Built from https://develop.svn.wordpress.org/trunk@44939 git-svn-id: http://core.svn.wordpress.org/trunk@44770 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/update-core.php | 21 ++++++++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index d157a46764..7239243333 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -294,6 +294,19 @@ function list_plugin_updates() { $compat .= '
' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version ); } } + + $compatible_php = ( empty( $plugin_data->update->requires_php ) || version_compare( phpversion(), $plugin_data->update->requires_php, '>=' ) ); + + if ( ! $compatible_php && current_user_can( 'update_php' ) ) { + $compat .= '
' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; + /* translators: %s: Update PHP page URL */ + $compat .= sprintf( + __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + $compat .= '

' . wp_get_update_php_annotation() . ''; + } + // Get the upgrade notice for the new plugin version. if ( isset( $plugin_data->update->upgrade_notice ) ) { $upgrade_notice = '
' . strip_tags( $plugin_data->update->upgrade_notice ); @@ -315,6 +328,7 @@ function list_plugin_updates() { ?> + +

- + Name; ?> Version, $plugin_data->update->new_version ); - echo ' ' . $details . $compat . $upgrade_notice; + echo ' ' . $details . $compat . $upgrade_notice; ?>

- diff --git a/wp-includes/version.php b/wp-includes/version.php index d9ac16c9c8..88f09b5bcb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2-alpha-44938'; +$wp_version = '5.2-alpha-44939'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.