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. Built from https://develop.svn.wordpress.org/trunk@34598 git-svn-id: http://core.svn.wordpress.org/trunk@34562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2079755bd8
commit
7b33ad2a99
|
@ -252,8 +252,25 @@ function list_plugin_updates() {
|
||||||
|
|
||||||
<tbody class="plugins">
|
<tbody class="plugins">
|
||||||
<?php
|
<?php
|
||||||
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
|
foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
|
||||||
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
|
$info = plugins_api( 'plugin_information', array(
|
||||||
|
'slug' => $plugin_data->update->slug,
|
||||||
|
'fields' => array(
|
||||||
|
'short_description' => false,
|
||||||
|
'sections' => false,
|
||||||
|
'requires' => false,
|
||||||
|
'rating' => false,
|
||||||
|
'ratings' => false,
|
||||||
|
'downloaded' => false,
|
||||||
|
'downloadlink' => false,
|
||||||
|
'last_updated' => false,
|
||||||
|
'added' => false,
|
||||||
|
'tags' => false,
|
||||||
|
'homepage' => false,
|
||||||
|
'donate_link' => false,
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
|
||||||
if ( is_wp_error( $info ) ) {
|
if ( is_wp_error( $info ) ) {
|
||||||
$info = false;
|
$info = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,11 +97,28 @@ if ( isset($_GET['action']) ) {
|
||||||
|
|
||||||
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
|
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
|
||||||
|
|
||||||
check_admin_referer('install-plugin_' . $plugin);
|
check_admin_referer( 'install-plugin_' . $plugin );
|
||||||
$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
|
$api = plugins_api( 'plugin_information', array(
|
||||||
|
'slug' => $plugin,
|
||||||
|
'fields' => array(
|
||||||
|
'short_description' => false,
|
||||||
|
'sections' => false,
|
||||||
|
'requires' => false,
|
||||||
|
'rating' => false,
|
||||||
|
'ratings' => false,
|
||||||
|
'downloaded' => false,
|
||||||
|
'last_updated' => false,
|
||||||
|
'added' => false,
|
||||||
|
'tags' => false,
|
||||||
|
'compatibility' => false,
|
||||||
|
'homepage' => false,
|
||||||
|
'donate_link' => false,
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
|
||||||
if ( is_wp_error($api) )
|
if ( is_wp_error( $api ) ) {
|
||||||
wp_die($api);
|
wp_die( $api );
|
||||||
|
}
|
||||||
|
|
||||||
$title = __('Plugin Install');
|
$title = __('Plugin Install');
|
||||||
$parent_file = 'plugins.php';
|
$parent_file = 'plugins.php';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34597';
|
$wp_version = '4.4-alpha-34598';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue