Make WordPress Core

Ticket #34415: 34415-wp_get_active_and_valid_plugins.diff

File 34415-wp_get_active_and_valid_plugins.diff, 880 bytes (added by swissspidy, 9 years ago)
  • src/wp-includes/load.php

    diff --git src/wp-includes/load.php src/wp-includes/load.php
    index c785128..36eded4 100644
    function wp_get_active_and_valid_plugins() { 
    552552        $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
    553553
    554554        foreach ( $active_plugins as $plugin ) {
     555                // Don't load older versions of the REST API.
     556                if ( 'rest-api/plugin.php' === $plugin ) {
     557                        $file_data = get_file_data( WP_PLUGIN_DIR . '/' . $plugin, array( 'Version' => 'version' ) );
     558                        if ( isset( $file_data['Version'] ) && version_compare( $file_data['Version'], '2.0-beta4', '<=' ) ) {
     559                                continue;
     560                        }
     561                }
     562
    555563                if ( ! validate_file( $plugin ) // $plugin must validate as file
    556564                        && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
    557565                        && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist