Upgrade/Install: Use is_php_version_compatible()
and is_wp_version_compatible()
in plugin and theme requirement checks.
Follow-up to [48390]. Props afragen. See #9757. git-svn-id: https://develop.svn.wordpress.org/trunk@48448 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b161e126a0
commit
51e92ced21
@ -214,7 +214,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$table .= '<tr><th></th><th>' . esc_html( __( 'Current' ) ) . '</th>';
|
||||
$table .= '<th>' . esc_html( __( 'Uploaded' ) ) . '</th></tr>';
|
||||
|
||||
$is_same_plugin = true; // Let's consider only these rows
|
||||
$is_same_plugin = true; // Let's consider only these rows.
|
||||
|
||||
foreach ( $rows as $field => $label ) {
|
||||
$old_value = ! empty( $current_plugin_data[ $field ] ) ? $current_plugin_data[ $field ] : '-';
|
||||
$new_value = ! empty( $this->upgrader->new_plugin_data[ $field ] ) ? $this->upgrader->new_plugin_data[ $field ] : '-';
|
||||
@ -248,9 +249,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$blocked_message = '<p>' . esc_html( __( 'The plugin cannot be updated due to the following:' ) ) . '</p>';
|
||||
$blocked_message .= '<ul class="ul-disc">';
|
||||
|
||||
if (
|
||||
! empty( $this->upgrader->new_plugin_data['RequiresPHP'] ) &&
|
||||
version_compare( phpversion(), $this->upgrader->new_plugin_data['RequiresPHP'], '<' )
|
||||
if ( ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] )
|
||||
&& ! is_php_version_compatible( $this->upgrader->new_plugin_data['RequiresPHP'] )
|
||||
) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current PHP version, 2: Version required by the uploaded plugin. */
|
||||
@ -263,9 +263,8 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$can_update = false;
|
||||
}
|
||||
|
||||
if (
|
||||
! empty( $this->upgrader->new_plugin_data['RequiresWP'] ) &&
|
||||
version_compare( $GLOBALS['wp_version'], $this->upgrader->new_plugin_data['RequiresWP'], '<' )
|
||||
if ( ! empty( $this->upgrader->new_plugin_data['RequiresWP'] )
|
||||
&& ! is_wp_version_compatible( $this->upgrader->new_plugin_data['RequiresWP'] )
|
||||
) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */
|
||||
|
@ -237,7 +237,8 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$table = '<table class="update-from-upload-comparison"><tbody>';
|
||||
$table .= '<tr><th></th><th>' . esc_html( __( 'Current' ) ) . '</th><th>' . esc_html( __( 'Uploaded' ) ) . '</th></tr>';
|
||||
|
||||
$is_same_theme = true; // Let's consider only these rows
|
||||
$is_same_theme = true; // Let's consider only these rows.
|
||||
|
||||
foreach ( $rows as $field => $label ) {
|
||||
$old_value = $current_theme_data->display( $field, false );
|
||||
$old_value = $old_value ? $old_value : '-';
|
||||
@ -283,7 +284,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$blocked_message = '<p>' . esc_html( __( 'The theme cannot be updated due to the following:' ) ) . '</p>';
|
||||
$blocked_message .= '<ul class="ul-disc">';
|
||||
|
||||
if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] ) && version_compare( phpversion(), $this->upgrader->new_theme_data['RequiresPHP'], '<' ) ) {
|
||||
if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] )
|
||||
&& ! is_php_version_compatible( $this->upgrader->new_theme_data['RequiresPHP'] )
|
||||
) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */
|
||||
__( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ),
|
||||
@ -295,7 +298,9 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$can_update = false;
|
||||
}
|
||||
|
||||
if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] ) && version_compare( $GLOBALS['wp_version'], $this->upgrader->new_theme_data['RequiresWP'], '<' ) ) {
|
||||
if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] )
|
||||
&& ! is_wp_version_compatible( $this->upgrader->new_theme_data['RequiresWP'] )
|
||||
) {
|
||||
$error = sprintf(
|
||||
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
|
||||
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),
|
||||
|
Loading…
Reference in New Issue
Block a user