WordPress.org

Make WordPress Core

Changeset 32778


Ignore:
Timestamp:
06/15/2015 03:31:40 AM (3 years ago)
Author:
dd32
Message:

Updates: When a error occurs during the connection phase, pass the error message back as the ajax failure message.
See #32435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r32751 r32778  
    29382938 */
    29392939function wp_ajax_update_plugin() {
     2940    global $wp_filesystem;
     2941
    29402942    $plugin = urldecode( $_POST['plugin'] );
    29412943
     
    30013003        $status['error'] = $result->get_error_message();
    30023004        wp_send_json_error( $status );
    3003     } else if ( is_bool( $result ) && ! $result ) {
     3005
     3006    } else if ( is_bool( $result ) && ! $result ) {
    30043007        $status['errorCode'] = 'unable_to_connect_to_filesystem';
    30053008        $status['error'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
     3009
     3010        // Pass through the error from WP_Filesystem if one was raised
     3011        if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
     3012            $status['error'] = $wp_filesystem->errors->get_error_message();
     3013        }
     3014
    30063015        wp_send_json_error( $status );
     3016
    30073017    }
    30083018}
Note: See TracChangeset for help on using the changeset viewer.