Make WordPress Core

Ticket #46024: 46024.diff

File 46024.diff, 2.5 KB (added by afragen, 5 years ago)

adjust version_compare logic

  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    diff --git trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php
    index 03c7e81c47..3ff7991fc5 100644
    class WP_Plugin_Install_List_Table extends WP_List_Table { 
    504504
    505505                        $wp_version = get_bloginfo( 'version' );
    506506
    507                         $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( substr( phpversion(), 0, strlen( $plugin['requires_php'] ) ), $plugin['requires_php'], '>=' ) );
    508                         $tested_wp      = ( empty( $plugin['tested'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '<=' ) );
    509                         $compatible_wp  = ( empty( $plugin['requires'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '>=' ) );
     507                        $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) );
     508                        $tested_wp      = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) );
     509                        $compatible_wp  = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) );
    510510
    511511                        $action_links = array();
    512512
  • trunk/src/wp-admin/includes/plugin-install.php

    diff --git trunk/src/wp-admin/includes/plugin-install.php trunk/src/wp-admin/includes/plugin-install.php
    index 92fdad384d..f2607cb9ef 100644
    function install_plugin_information() { 
    756756        <?php
    757757        $wp_version = get_bloginfo( 'version' );
    758758
    759         $compatible_php = ( empty( $api->requires_php ) || version_compare( substr( phpversion(), 0, strlen( $api->requires_php ) ), $api->requires_php, '>=' ) );
    760         $tested_wp      = ( empty( $api->tested ) || version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '<=' ) );
    761         $compatible_wp  = ( empty( $api->requires ) || version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '>=' ) );
     759        $compatible_php = ( empty( $api->requires_php ) || version_compare( phpversion(), $api->requires_php, '>=' ) );
     760        $tested_wp      = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) );
     761        $compatible_wp  = ( empty( $api->requires ) || version_compare( $wp_version, $api->requires, '>=' ) );
    762762
    763763        if ( ! $compatible_php ) {
    764764                echo '<div class="notice notice-error notice-alt"><p>';