Make WordPress Core


Ignore:
Timestamp:
09/26/2015 03:49:06 PM (11 years ago)
Author:
ocean90
Message:

Plugins: Don't request all fields via plugins_api( 'plugin_information' ) for plugin installs and update checks.

The Plugins API returns a lot of data by default (see [34596]) but when installing or checking for updates we don't need all of it. To save bandwidth, memory and time request only required fields.

Fixes #34030.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update.php

    r34265 r34598  
    9898                include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
    9999
    100                 check_admin_referer('install-plugin_' . $plugin);
    101                 $api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
    102 
    103                 if ( is_wp_error($api) )
    104                         wp_die($api);
     100                check_admin_referer( 'install-plugin_' . $plugin );
     101                $api = plugins_api( 'plugin_information', array(
     102                        'slug' => $plugin,
     103                        'fields' => array(
     104                                'short_description' => false,
     105                                'sections' => false,
     106                                'requires' => false,
     107                                'rating' => false,
     108                                'ratings' => false,
     109                                'downloaded' => false,
     110                                'last_updated' => false,
     111                                'added' => false,
     112                                'tags' => false,
     113                                'compatibility' => false,
     114                                'homepage' => false,
     115                                'donate_link' => false,
     116                        ),
     117                ) );
     118
     119                if ( is_wp_error( $api ) ) {
     120                        wp_die( $api );
     121                }
    105122
    106123                $title = __('Plugin Install');
Note: See TracChangeset for help on using the changeset viewer.