Make WordPress Core


Ignore:
Timestamp:
03/20/2019 01:43:05 AM (6 years ago)
Author:
desrosj
Message:

Plugins: Block plugin updates if required PHP version is not supported.

When a plugin states it requires a specific minimum PHP version (as defined in the requires_php field included in the plugin update API response), a user should not be allowed to update that plugin when the server does not satisfy the minimum PHP version.

When this scenario is encountered, the update buttons and links are disabled and links to educational resources about PHP are displayed to the user with a notice.

Props afragen, schlessera, desrosj.
Fixes #43987.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r44717 r44937  
    747747        }
    748748
    749         $class       = $is_active ? 'active' : 'inactive';
    750         $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] );
    751         if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
     749        $compatible_php = ( empty( $plugin_data['requires_php'] ) || version_compare( phpversion(), $plugin_data['requires_php'], '>=' ) );
     750        $class          = $is_active ? 'active' : 'inactive';
     751        $checkbox_id    = 'checkbox_' . md5( $plugin_data['Name'] );
     752        if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) || ! $compatible_php ) {
    752753            $checkbox = '';
    753754        } else {
Note: See TracChangeset for help on using the changeset viewer.