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/plugin-install.php

    r44656 r44937  
    770770                esc_url( wp_get_update_php_url() )
    771771            );
    772             echo '</p>';
    773             wp_update_php_annotation();
     772
     773            wp_update_php_annotation( '</p><p><em>', '</em>' );
    774774        } else {
    775775            echo '</p>';
     
    828828            case 'update_available':
    829829                if ( $status['url'] ) {
    830                     echo '<a data-slug="' . esc_attr( $api->slug ) . '" data-plugin="' . esc_attr( $status['file'] ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) . '</a>';
     830                    if ( $compatible_php ) {
     831                        echo '<a data-slug="' . esc_attr( $api->slug ) . '" data-plugin="' . esc_attr( $status['file'] ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) . '</a>';
     832                    } else {
     833                        printf(
     834                            '<button type="button" class="button button-primary button-disabled right" disabled="disabled">%s</button>',
     835                            _x( 'Cannot Update', 'plugin' )
     836                        );
     837                    }
    831838                }
    832839                break;
Note: See TracChangeset for help on using the changeset viewer.