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

See #32435

Built from https://develop.svn.wordpress.org/trunk@32778


git-svn-id: http://core.svn.wordpress.org/trunk@32749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-06-15 03:32:27 +00:00
parent 04325cd834
commit 0eb8bfc464
2 changed files with 12 additions and 2 deletions

View File

@ -2937,6 +2937,8 @@ function wp_ajax_destroy_sessions() {
* @see Plugin_Upgrader
*/
function wp_ajax_update_plugin() {
global $wp_filesystem;
$plugin = urldecode( $_POST['plugin'] );
$status = array(
@ -3000,10 +3002,18 @@ function wp_ajax_update_plugin() {
} else if ( is_wp_error( $result ) ) {
$status['error'] = $result->get_error_message();
wp_send_json_error( $status );
} else if ( is_bool( $result ) && ! $result ) {
} else if ( is_bool( $result ) && ! $result ) {
$status['errorCode'] = 'unable_to_connect_to_filesystem';
$status['error'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
// Pass through the error from WP_Filesystem if one was raised
if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
$status['error'] = $wp_filesystem->errors->get_error_message();
}
wp_send_json_error( $status );
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32777';
$wp_version = '4.3-alpha-32778';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.