WordPress.org

Make WordPress Core

Changeset 48448


Ignore:
Timestamp:
07/12/2020 10:53:36 AM (4 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-plugin-installer-skin.php

    r48447 r48448  
    215215        $table .= '<th>' . esc_html( __( 'Uploaded' ) ) . '</th></tr>';
    216216
    217         $is_same_plugin = true; // Let's consider only these rows
     217        $is_same_plugin = true; // Let's consider only these rows.
     218
    218219        foreach ( $rows as $field => $label ) {
    219220            $old_value = ! empty( $current_plugin_data[ $field ] ) ? $current_plugin_data[ $field ] : '-';
     
    249250        $blocked_message .= '<ul class="ul-disc">';
    250251
    251         if (
    252             ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] ) &&
    253             version_compare( phpversion(), $this->upgrader->new_plugin_data['RequiresPHP'], '<' )
     252        if ( ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] )
     253            && ! is_php_version_compatible( $this->upgrader->new_plugin_data['RequiresPHP'] )
    254254        ) {
    255255            $error = sprintf(
     
    264264        }
    265265
    266         if (
    267             ! empty( $this->upgrader->new_plugin_data['RequiresWP'] ) &&
    268             version_compare( $GLOBALS['wp_version'], $this->upgrader->new_plugin_data['RequiresWP'], '<' )
     266        if ( ! empty( $this->upgrader->new_plugin_data['RequiresWP'] )
     267            && ! is_wp_version_compatible( $this->upgrader->new_plugin_data['RequiresWP'] )
    269268        ) {
    270269            $error = sprintf(
  • trunk/src/wp-admin/includes/class-theme-installer-skin.php

    r48447 r48448  
    238238        $table .= '<tr><th></th><th>' . esc_html( __( 'Current' ) ) . '</th><th>' . esc_html( __( 'Uploaded' ) ) . '</th></tr>';
    239239
    240         $is_same_theme = true; // Let's consider only these rows
     240        $is_same_theme = true; // Let's consider only these rows.
     241
    241242        foreach ( $rows as $field => $label ) {
    242243            $old_value = $current_theme_data->display( $field, false );
     
    284285        $blocked_message .= '<ul class="ul-disc">';
    285286
    286         if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] ) && version_compare( phpversion(), $this->upgrader->new_theme_data['RequiresPHP'], '<' ) ) {
     287        if ( ! empty( $this->upgrader->new_theme_data['RequiresPHP'] )
     288            && ! is_php_version_compatible( $this->upgrader->new_theme_data['RequiresPHP'] )
     289        ) {
    287290            $error = sprintf(
    288291                /* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */
     
    296299        }
    297300
    298         if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] ) && version_compare( $GLOBALS['wp_version'], $this->upgrader->new_theme_data['RequiresWP'], '<' ) ) {
     301        if ( ! empty( $this->upgrader->new_theme_data['RequiresWP'] )
     302            && ! is_wp_version_compatible( $this->upgrader->new_theme_data['RequiresWP'] )
     303        ) {
    299304            $error = sprintf(
    300305                /* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
Note: See TracChangeset for help on using the changeset viewer.