| | 802 | // If WP_Error send data to WordPress.org. |
| | 803 | if ( is_wp_error( $result ) ) { |
| | 804 | global $wp_version, $wp_filesystem; |
| | 805 | $stats = array( |
| | 806 | 'update_type' => null, |
| | 807 | 'name' => null, |
| | 808 | 'update_version' => null, |
| | 809 | 'success' => false, |
| | 810 | 'fs_method' => $wp_filesystem->method, |
| | 811 | 'fs_method_forced' => defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' ), |
| | 812 | 'fs_method_direct' => ! empty( $GLOBALS['_wp_filesystem_direct_method'] ) ? $GLOBALS['_wp_filesystem_direct_method'] : '', |
| | 813 | 'time_taken' => time() - $start_time, |
| | 814 | 'wp_version' => $wp_version, |
| | 815 | 'error_code' => $result->get_error_code(), |
| | 816 | 'error_message' => $result->get_error_message(), |
| | 817 | 'error_data' => $result->get_error_data(), |
| | 818 | ); |
| | 819 | if ( $this instanceof Plugin_Upgrader ) { |
| | 820 | if ( $this->skin instanceof Automatic_Upgrader_Skin ) { |
| | 821 | $stats['update_type'] = 'automatic_plugin_update'; |
| | 822 | } |
| | 823 | if ( $this->skin instanceof Plugin_Upgrader_Skin ) { |
| | 824 | $stats['update_type'] = 'manual_plugin_update'; |
| | 825 | $stats['name'] = $this->skin->plugin_info['Name']; |
| | 826 | $stats['update_version'] = $this->skin->plugin_info['Version']; |
| | 827 | } |
| | 828 | wp_update_plugins( $stats ); |
| | 829 | } |
| | 830 | if ( $this instanceof Theme_Upgrader ) { |
| | 831 | if ( $this->skin instanceof Automatic_Upgrader_Skin ) { |
| | 832 | $stats['update_type'] = 'automatic_theme_update'; |
| | 833 | } |
| | 834 | if ( $this->skin instanceof Theme_Upgrader_Skin ) { |
| | 835 | $stats['update_type'] = 'manual_theme_update'; |
| | 836 | $stats['name'] = $this->skin->theme_info->get('Name'); |
| | 837 | $stats['update_version'] = $this->skin->theme_info->get('Version'); |
| | 838 | } |
| | 839 | wp_update_themes( $stats ); |
| | 840 | } |
| | 841 | } |
| | 842 | |