From 8e96288144daca65650539c2a58255be1a5cde65 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 17 Jul 2015 03:55:28 +0000 Subject: [PATCH] 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'. Merges [32570] to the 4.2 branch. Fixes #32465 Built from https://develop.svn.wordpress.org/branches/4.2@33301 git-svn-id: http://core.svn.wordpress.org/branches/4.2@33273 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 2b5ec7fba5..cfb3ccce3e 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -2892,6 +2892,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'] ); @@ -2926,7 +2927,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'] );