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