From cdede88a23b8a2fa6827f9db629e943871434401 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 14 Oct 2013 23:33:10 +0000 Subject: [PATCH] Automatic updates: Include error data in the follow-up API request. props dd32. see #22704. Built from https://develop.svn.wordpress.org/trunk@25781 git-svn-id: http://core.svn.wordpress.org/trunk@25694 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 4 ++++ wp-includes/update.php | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 4ffe3aa006..b6cfa9bdfd 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1747,12 +1747,16 @@ class WP_Automatic_Upgrader { $core_update_result = self::upgrade( 'core', $core_update ); delete_site_transient( 'update_core' ); $extra_update_stats['success'] = is_wp_error( $core_update_result ) ? $core_update_result->get_error_code() : true; + $extra_update_stats['error_data'] = is_wp_error( $core_update_result ) ? $core_update_result->get_error_data() : ''; if ( is_wp_error( $core_update_result ) && 'rollback_was_required' == $core_update_result->get_error_code() ) { $rollback_data = $core_update_result->get_error_data(); $extra_update_stats['success'] = is_wp_error( $rollback_data['update'] ) ? $rollback_data['update']->get_error_code() : $rollback_data['update']; + $extra_update_stats['error_data'] = is_wp_error( $rollback_data['update'] ) ? $rollback_data['update']->get_error_data() : ''; $extra_update_stats['rollback'] = is_wp_error( $rollback_data['rollback'] ) ? $rollback_data['rollback']->get_error_code() : true; // If it's not a WP_Error, the rollback was successful. + $extra_update_stats['rollback_data'] = is_wp_error( $rollback_data['rollback'] ) ? $rollback_data['rollback']->get_error_data() : ''; } $extra_update_stats['fs_method'] = $GLOBALS['wp_filesystem']->method; + $extra_update_stats['fs_method_forced'] = defined( 'FS_METHOD' ) || has_filter( 'fs_method' ); $extra_update_stats['time_taken'] = ( time() - $start_time ); $extra_update_stats['attempted'] = $core_update->version; } diff --git a/wp-includes/update.php b/wp-includes/update.php index b6aed5db23..c0eaf1b753 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -86,8 +86,12 @@ function wp_version_check( $extra_stats = array() ) { 'multisite_enabled' => $multisite_enabled, ); + $post_body = array( + 'translations' => json_encode( $translations ), + ); + if ( $extra_stats ) - $query = array_merge( $query, $extra_stats ); + $post_body = array_merge( $post_body, $extra_stats ); $url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' ); if ( wp_http_supports( array( 'ssl' ) ) ) @@ -100,9 +104,7 @@ function wp_version_check( $extra_stats = array() ) { 'wp_install' => $wp_install, 'wp_blog' => home_url( '/' ) ), - 'body' => array( - 'translations' => json_encode( $translations ), - ), + 'body' => $post_body, ); $response = wp_remote_post( $url, $options );