Shiny Updates: Handle the case where the plugin is installed into a different directory than it previously existed in.

A good example of this is when the plugin being updated is currently installed as 'Plugin-Name' but the canonical directory is 'plugin-name', but it can also occur when the plugin is installed in 'super-cool-plugin' and it's canonical name is 'average-plugin'.

Fixes #32465 for trunk


git-svn-id: https://develop.svn.wordpress.org/trunk@32570 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-05-24 08:04:55 +00:00
parent 065cdadce9
commit 8d64dc4e6b

View File

@ -2902,6 +2902,7 @@ function wp_ajax_update_plugin() {
'oldVersion' => '',
'newVersion' => '',
);
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( $plugin_data['Version'] ) {
$status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
@ -2939,7 +2940,8 @@ function wp_ajax_update_plugin() {
wp_send_json_error( $status );
}
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$plugin_data = get_plugins( '/' . $result[ $plugin ]['destination_name'] );
$plugin_data = reset( $plugin_data );
if ( $plugin_data['Version'] ) {
$status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );