Add an `@see` mention for `Plugin_Upgrader`, plus spacing to the `wp_ajax_update_plugin()` delcaration.

See #31888.


git-svn-id: https://develop.svn.wordpress.org/trunk@32006 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2015-04-04 14:18:52 +00:00
parent 3e5eeaf6f0
commit 5394bd31a0
1 changed files with 6 additions and 0 deletions

View File

@ -2881,6 +2881,8 @@ function wp_ajax_destroy_sessions() {
* AJAX handler for updating a plugin.
*
* @since 4.2.0
*
* @see Plugin_Upgrader
*/
function wp_ajax_update_plugin() {
$plugin = urldecode( $_POST['plugin'] );
@ -2916,6 +2918,7 @@ function wp_ajax_update_plugin() {
if ( is_array( $result ) ) {
$plugin_update_data = current( $result );
/*
* If the `update_plugins` site transient is empty (e.g. when you update
* two plugins in quick succession before the transient repopulates),
@ -2927,10 +2930,13 @@ function wp_ajax_update_plugin() {
if ( $plugin_update_data === true ) {
wp_send_json_error( $status );
}
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( $plugin_data['Version'] ) {
$status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
}
wp_send_json_success( $status );
} else if ( is_wp_error( $result ) ) {
$status['error'] = $result->get_error_message();