Ticket #10611: 10611.diff
File 10611.diff, 5.5 KB (added by , 13 years ago) |
---|
-
wp-includes/update.php
58 58 } 59 59 60 60 $local_package = isset( $wp_local_package )? $wp_local_package : ''; 61 $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"; 62 62 63 63 $options = array( 64 64 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ), … … 75 75 return false; 76 76 77 77 $body = trim( wp_remote_retrieve_body( $response ) ); 78 $body = str_replace(array("\r\n", "\r"), "\n", $body); 79 $new_options = array(); 80 foreach ( explode( "\n\n", $body ) as $entry ) { 81 $returns = explode("\n", $entry); 82 $new_option = new stdClass(); 83 $new_option->response = esc_attr( $returns[0] ); 84 if ( isset( $returns[1] ) ) 85 $new_option->url = esc_url( $returns[1] ); 86 if ( isset( $returns[2] ) ) 87 $new_option->package = esc_url( $returns[2] ); 88 if ( isset( $returns[3] ) ) 89 $new_option->current = esc_attr( $returns[3] ); 90 if ( isset( $returns[4] ) ) 91 $new_option->locale = esc_attr( $returns[4] ); 92 if ( isset( $returns[5] ) ) 93 $new_option->php_version = esc_attr( $returns[5] ); 94 if ( isset( $returns[6] ) ) 95 $new_option->mysql_version = esc_attr( $returns[6] ); 96 $new_options[] = $new_option; 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'] ), array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial' ), '' ) ); 88 elseif ( 'download' == $offer_key ) 89 $offer['download'] = esc_url( $value ); 90 else 91 $offer[ $offer_key ] = esc_html( $value ); 92 } 93 $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale', 'packages', 'current', 'php_version', 'mysql_version', 'new_bundled' ), '' ) ); 97 94 } 98 95 96 var_dump( $offers ); 97 99 98 $updates = new stdClass(); 100 $updates->updates = $ new_options;99 $updates->updates = $offers; 101 100 $updates->last_checked = time(); 102 101 $updates->version_checked = $wp_version; 103 102 set_site_transient( 'update_core', $updates); … … 286 285 287 286 $current = get_site_transient( 'update_core' ); 288 287 289 if ( isset( $current->last_checked ) &&288 if ( false && isset( $current->last_checked ) && 290 289 43200 > ( time() - $current->last_checked ) && 291 290 isset( $current->version_checked ) && 292 291 $current->version_checked == $wp_version ) -
wp-admin/includes/class-wp-upgrader.php
885 885 886 886 $wp_dir = trailingslashit($wp_filesystem->abspath()); 887 887 888 $download = $this->download_package( $current->package ); 888 // If partial update is returned from the API, use that, unless we're doing a reinstall. 889 // If we cross the new_bundled version number, then use the new_bundled zip. 890 // Don't though if the constant is set to skip bundled items. 891 // If the API returns a no_content zip, go with it. Finally, default to the full zip. 892 if ( $current->packages->partial && 'reinstall' != $current->response ) 893 $to_download = 'partial'; 894 elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) 895 && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) 896 $to_download = 'new_bundled'; 897 elseif ( $current->packages->no_content ) 898 $to_download = 'no_content'; 899 else 900 $to_download = 'full'; 901 902 $download = $this->download_package( $current->packages->$to_download ); 889 903 if ( is_wp_error($download) ) 890 904 return $download; 891 905 -
wp-admin/update-core.php
19 19 20 20 function list_core_update( $update ) { 21 21 global $wp_local_package, $wpdb; 22 static $primary_button = ' button-primary'; 23 22 24 $version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ? 23 25 $update->current : sprintf("%s–<strong>%s</strong>", $update->current, $update->locale); 24 26 $current = false; … … 63 65 echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; 64 66 echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; 65 67 if ( $show_buttons ) { 66 submit_button( $submit, 'button', 'upgrade', false ); 67 echo ' <a href="' . esc_url($update->package) . '" class="button">' . $download . '</a> '; 68 submit_button( $submit, 'button' . $primary_button, 'upgrade', false ); 69 $primary_button = ''; 70 echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; 68 71 } 69 72 if ( 'en_US' != $update->locale ) 70 73 if ( !isset( $update->dismissed ) || !$update->dismissed )