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. git-svn-id: https://develop.svn.wordpress.org/trunk@34598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
60660b0055
commit
5da80b3d64
@ -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';
|
||||||
|
Loading…
Reference in New Issue
Block a user