Changes in trunk/wp-includes/update.php [17231:18227]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/update.php
r17231 r18227 24 24 return; 25 25 26 global $wp_version, $wpdb, $wp_local_package; 26 global $wpdb, $wp_local_package; 27 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 27 28 $php_version = phpversion(); 28 29 … … 58 59 59 60 $local_package = isset( $wp_local_package )? $wp_local_package : ''; 60 $url = "http://api.wordpress.org/core/version-check/1. 5/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled";61 $url = "http://api.wordpress.org/core/version-check/1.6-beta/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled"; 61 62 62 63 $options = array( … … 71 72 $response = wp_remote_get($url, $options); 72 73 73 if ( is_wp_error( $response ) ) 74 return false; 75 76 if ( 200 != $response['response']['code'] ) 77 return false; 78 79 $body = trim( $response['body'] ); 80 $body = str_replace(array("\r\n", "\r"), "\n", $body); 81 $new_options = array(); 82 foreach ( explode( "\n\n", $body ) as $entry ) { 83 $returns = explode("\n", $entry); 84 $new_option = new stdClass(); 85 $new_option->response = esc_attr( $returns[0] ); 86 if ( isset( $returns[1] ) ) 87 $new_option->url = esc_url( $returns[1] ); 88 if ( isset( $returns[2] ) ) 89 $new_option->package = esc_url( $returns[2] ); 90 if ( isset( $returns[3] ) ) 91 $new_option->current = esc_attr( $returns[3] ); 92 if ( isset( $returns[4] ) ) 93 $new_option->locale = esc_attr( $returns[4] ); 94 if ( isset( $returns[5] ) ) 95 $new_option->php_version = esc_attr( $returns[5] ); 96 if ( isset( $returns[6] ) ) 97 $new_option->mysql_version = esc_attr( $returns[6] ); 98 $new_options[] = $new_option; 74 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 75 return false; 76 77 $body = trim( wp_remote_retrieve_body( $response ) ); 78 if ( ! $body = maybe_unserialize( $body ) ) 79 return false; 80 if ( ! isset( $body['offers'] ) ) 81 return false; 82 $offers = $body['offers']; 83 84 foreach ( $offers as &$offer ) { 85 foreach ( $offer as $offer_key => $value ) { 86 if ( 'packages' == $offer_key ) 87 $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ), 88 array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial' ), '' ) ); 89 elseif ( 'download' == $offer_key ) 90 $offer['download'] = esc_url( $value ); 91 else 92 $offer[ $offer_key ] = esc_html( $value ); 93 } 94 $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 95 'packages', 'current', 'php_version', 'mysql_version', 'new_bundled', 'partial_version' ), '' ) ); 99 96 } 100 97 101 98 $updates = new stdClass(); 102 $updates->updates = $ new_options;99 $updates->updates = $offers; 103 100 $updates->last_checked = time(); 104 101 $updates->version_checked = $wp_version; … … 120 117 */ 121 118 function wp_update_plugins() { 122 global $wp_version;119 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 123 120 124 121 if ( defined('WP_INSTALLING') ) … … 175 172 $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options); 176 173 177 if ( is_wp_error( $raw_response ) ) 178 return false; 179 180 if ( 200 != $raw_response['response']['code'] ) 181 return false; 182 183 $response = unserialize( $raw_response['body'] ); 174 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 175 return false; 176 177 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 184 178 185 179 if ( false !== $response ) … … 204 198 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 205 199 */ 206 function wp_update_themes( 207 global $wp_version;200 function wp_update_themes() { 201 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 208 202 209 203 if ( defined( 'WP_INSTALLING' ) ) … … 273 267 $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options ); 274 268 275 if ( is_wp_error( $raw_response ) ) 276 return false; 277 278 if ( 200 != $raw_response['response']['code'] ) 269 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 279 270 return false; 280 271 281 272 $new_update = new stdClass; 282 273 $new_update->last_checked = time( ); 283 $response = unserialize( $raw_response['body'] ); 284 if ( $response ) { 285 $new_update->checked = $checked; 274 $new_update->checked = $checked; 275 276 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 277 if ( false !== $response ) 286 278 $new_update->response = $response; 287 }288 279 289 280 set_site_transient( 'update_themes', $new_update ); … … 291 282 292 283 function _maybe_update_core() { 293 global $wp_version;284 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version 294 285 295 286 $current = get_site_transient( 'update_core' );
Note: See TracChangeset
for help on using the changeset viewer.