Changeset 38199
- Timestamp:
- 08/04/2016 10:17:44 PM (8 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r38168 r38199 3346 3346 } 3347 3347 3348 $upgrader = new Theme_Upgrader( new Automatic_Upgrader_Skin() ); 3348 $skin = new WP_Ajax_Upgrader_Skin(); 3349 $upgrader = new Theme_Upgrader( $skin ); 3349 3350 $result = $upgrader->install( $api->download_link ); 3350 3351 3351 3352 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 3352 $status['debug'] = $ upgrader->skin->get_upgrade_messages();3353 $status['debug'] = $skin->get_upgrade_messages(); 3353 3354 } 3354 3355 3355 3356 if ( is_wp_error( $result ) ) { 3357 $status['errorCode'] = $result->get_error_code(); 3356 3358 $status['errorMessage'] = $result->get_error_message(); 3359 wp_send_json_error( $status ); 3360 } elseif ( is_wp_error( $skin->result ) ) { 3361 $status['errorCode'] = $skin->result->get_error_code(); 3362 $status['errorMessage'] = $skin->result->get_error_message(); 3363 wp_send_json_error( $status ); 3364 } elseif ( $skin->get_errors()->get_error_code() ) { 3365 $status['errorMessage'] = $skin->get_error_messages(); 3357 3366 wp_send_json_error( $status ); 3358 3367 } elseif ( is_null( $result ) ) { … … 3438 3447 } 3439 3448 3440 $upgrader = new Theme_Upgrader( new Automatic_Upgrader_Skin() ); 3449 $skin = new WP_Ajax_Upgrader_Skin(); 3450 $upgrader = new Theme_Upgrader( $skin ); 3441 3451 $result = $upgrader->bulk_upgrade( array( $stylesheet ) ); 3442 3452 3443 3453 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 3444 $status['debug'] = $upgrader->skin->get_upgrade_messages(); 3445 } 3446 3447 if ( is_array( $result ) && ! empty( $result[ $stylesheet ] ) ) { 3454 $status['debug'] = $skin->get_upgrade_messages(); 3455 } 3456 3457 if ( is_wp_error( $skin->result ) ) { 3458 $status['errorCode'] = $skin->result->get_error_code(); 3459 $status['errorMessage'] = $skin->result->get_error_message(); 3460 wp_send_json_error( $status ); 3461 } elseif ( $skin->get_errors()->get_error_code() ) { 3462 $status['errorMessage'] = $skin->get_error_messages(); 3463 wp_send_json_error( $status ); 3464 } elseif ( is_array( $result ) && ! empty( $result[ $stylesheet ] ) ) { 3448 3465 3449 3466 // Theme is already at the latest version. … … 3459 3476 3460 3477 wp_send_json_success( $status ); 3461 } elseif ( is_wp_error( $upgrader->skin->result ) ) {3462 $status['errorCode'] = $upgrader->skin->result->get_error_code();3463 $status['errorMessage'] = $upgrader->skin->result->get_error_message();3464 wp_send_json_error( $status );3465 3478 } elseif ( false === $result ) { 3466 3479 global $wp_filesystem; … … 3595 3608 $status['pluginName'] = $api->name; 3596 3609 3597 $upgrader = new Plugin_Upgrader( new Automatic_Upgrader_Skin() ); 3610 $skin = new WP_Ajax_Upgrader_Skin(); 3611 $upgrader = new Plugin_Upgrader( $skin ); 3598 3612 $result = $upgrader->install( $api->download_link ); 3599 3613 3600 3614 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 3601 $status['debug'] = $ upgrader->skin->get_upgrade_messages();3615 $status['debug'] = $skin->get_upgrade_messages(); 3602 3616 } 3603 3617 3604 3618 if ( is_wp_error( $result ) ) { 3619 $status['errorCode'] = $result->get_error_code(); 3605 3620 $status['errorMessage'] = $result->get_error_message(); 3621 wp_send_json_error( $status ); 3622 } elseif ( is_wp_error( $skin->result ) ) { 3623 $status['errorCode'] = $skin->result->get_error_code(); 3624 $status['errorMessage'] = $skin->result->get_error_message(); 3625 wp_send_json_error( $status ); 3626 } elseif ( $skin->get_errors()->get_error_code() ) { 3627 $status['errorMessage'] = $skin->get_error_messages(); 3606 3628 wp_send_json_error( $status ); 3607 3629 } elseif ( is_null( $result ) ) { … … 3681 3703 wp_update_plugins(); 3682 3704 3683 $skin = new Automatic_Upgrader_Skin();3705 $skin = new WP_Ajax_Upgrader_Skin(); 3684 3706 $upgrader = new Plugin_Upgrader( $skin ); 3685 3707 $result = $upgrader->bulk_upgrade( array( $plugin ) ); 3686 3708 3687 3709 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 3688 $status['debug'] = $upgrader->skin->get_upgrade_messages(); 3689 } 3690 3691 if ( is_array( $result ) && empty( $result[ $plugin ] ) && is_wp_error( $skin->result ) ) { 3692 $result = $skin->result; 3693 } 3694 3695 if ( is_array( $result ) && ! empty( $result[ $plugin ] ) ) { 3710 $status['debug'] = $skin->get_upgrade_messages(); 3711 } 3712 3713 if ( is_wp_error( $skin->result ) ) { 3714 $status['errorCode'] = $skin->result->get_error_code(); 3715 $status['errorMessage'] = $skin->result->get_error_message(); 3716 wp_send_json_error( $status ); 3717 } elseif ( $skin->get_errors()->get_error_code() ) { 3718 $status['errorMessage'] = $skin->get_error_messages(); 3719 wp_send_json_error( $status ); 3720 } elseif ( is_array( $result ) && ! empty( $result[ $plugin ] ) ) { 3696 3721 $plugin_update_data = current( $result ); 3697 3722 … … 3717 3742 } 3718 3743 wp_send_json_success( $status ); 3719 } elseif ( is_wp_error( $result ) ) {3720 $status['errorMessage'] = $result->get_error_message();3721 wp_send_json_error( $status );3722 3744 } elseif ( false === $result ) { 3723 3745 global $wp_filesystem; -
trunk/src/wp-admin/includes/class-wp-upgrader-skins.php
r37408 r38199 37 37 /** Automatic_Upgrader_Skin class */ 38 38 require_once ABSPATH . 'wp-admin/includes/class-automatic-upgrader-skin.php'; 39 40 /** WP_Ajax_Upgrader_Skin class */ 41 require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php'; -
trunk/src/wp-admin/includes/class-wp-upgrader.php
r38074 r38199 39 39 /** Automatic_Upgrader_Skin class */ 40 40 require_once ABSPATH . 'wp-admin/includes/class-automatic-upgrader-skin.php'; 41 42 /** WP_Ajax_Upgrader_Skin class */ 43 require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php'; 41 44 42 45 /** -
trunk/src/wp-admin/js/updates.js
r38196 r38199 245 245 */ 246 246 wp.updates.ajaxAlways = function( response ) { 247 if ( ! response.errorCode &&'unable_to_connect_to_filesystem' !== response.errorCode ) {247 if ( ! response.errorCode || 'unable_to_connect_to_filesystem' !== response.errorCode ) { 248 248 wp.updates.ajaxLocked = false; 249 249 wp.updates.queueChecker(); … … 1534 1534 */ 1535 1535 wp.updates.maybeHandleCredentialError = function( response, action ) { 1536 if ( response.errorCode && 'unable_to_connect_to_filesystem' === response.errorCode ) {1536 if ( wp.updates.shouldRequestFilesystemCredentials && response.errorCode && 'unable_to_connect_to_filesystem' === response.errorCode ) { 1537 1537 wp.updates.credentialError( response, action ); 1538 1538 return true;
Note: See TracChangeset
for help on using the changeset viewer.