Merge pull request #14842 from woocommerce/fix/14799

Get outdated plugins using get_plugin_updates()
This commit is contained in:
Claudio Sanches 2017-05-03 18:42:17 -03:00 committed by GitHub
commit abfedafd46
1 changed files with 4 additions and 14 deletions

View File

@ -686,6 +686,8 @@ class WC_REST_System_Status_Controller extends WC_REST_Controller {
}
$active_plugins_data = array();
$available_updates = get_plugin_updates();
foreach ( $active_plugins as $plugin ) {
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$dirname = dirname( $plugin );
@ -712,20 +714,8 @@ class WC_REST_System_Status_Controller extends WC_REST_Controller {
}
}
$version_latest = $version_data['version'];
} else {
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
$api = plugins_api( 'plugin_information', array(
'slug' => $slug,
'fields' => array(
'sections' => false,
'tags' => false,
),
) );
if ( is_object( $api ) && ! is_wp_error( $api ) && ! empty( $api->version ) ) {
$version_latest = $api->version;
}
} elseif ( isset( $available_updates[ $plugin ]->update->new_version ) ) {
$version_latest = $available_updates[ $plugin ]->update->new_version;
}
// convert plugin data to json response format.