Ticket #16156: 16156.diff
| File 16156.diff, 4.6 KB (added by , 15 years ago) |
|---|
-
wp-admin/update-core.php
133 133 echo '</p></div>'; 134 134 } 135 135 136 echo '<p>'; 137 /* translators: %1 date, %2 time. */ 138 printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); 136 $current = get_site_transient( 'update_core' ); 137 $current->last_success = $current->last_success - 30*60*60; 138 $last_success = $current->last_success + (get_option( 'gmt_offset' ) * 3600); // display teh time in the users localtimezone. 139 140 if ( $current->last_success > time()-24*60*60 ) { // If it was within the last 24hrs 141 echo '<div><p>'; 142 /* translators: %1 date, %2 time. */ 143 printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ), $last_success ), date_i18n( get_option( 'time_format' ), $last_success ) ); 144 } else { // Update is not happening.. 145 echo '<div class="error"><p>'; 146 /* translators: %1 date, %2 time, %3 error string */ 147 printf( __('The last successful update check was over 24 hours ago (%1$s %2$s), This means that WordPress is encountering an error whilst performing the update check. The error that is being reported is <code>%3$s</code> See the <a href="">Codex</a> for potential solutions.'), 148 date_i18n( get_option( 'date_format' ), $last_success ), date_i18n( get_option( 'time_format' ), $last_success ), $current->error->get_error_message() ); 149 } 139 150 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>'; 140 echo '</p> ';151 echo '</p></div>'; 141 152 142 153 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { 143 154 echo '<h3>'; -
wp-includes/update.php
23 23 if ( defined('WP_INSTALLING') ) 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'; // for an unmodified $wp_version 27 28 $php_version = phpversion(); 28 29 29 30 $current = get_site_transient( 'update_core' ); … … 31 32 $current = new stdClass; 32 33 $current->updates = array(); 33 34 $current->version_checked = $wp_version; 35 $current->last_success = false; 34 36 } 35 37 36 38 $locale = apply_filters( 'core_version_check_locale', get_locale() ); … … 57 59 } 58 60 59 61 $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";62 $url = "http://localhost/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 63 62 64 $options = array( 63 65 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ), … … 70 72 71 73 $response = wp_remote_get($url, $options); 72 74 73 if ( is_wp_error( $response ) ) 75 if ( is_wp_error( $response ) || 200 != $response['response']['code'] /* || 'php/serialized' != Some header */ ) { 76 $current->error = is_wp_error($response) ? $response : new WP_Error('update_404', __('The server returned an unexpected response')); 77 set_site_transient( 'update_core', $current ); 74 78 return false; 79 } 75 80 76 if ( 200 != $response['response']['code'] )77 return false;78 79 81 $body = trim( $response['body'] ); 80 82 $body = str_replace(array("\r\n", "\r"), "\n", $body); 81 83 $new_options = array(); … … 101 103 $updates = new stdClass(); 102 104 $updates->updates = $new_options; 103 105 $updates->last_checked = time(); 106 $updates->last_success = time(); 104 107 $updates->version_checked = $wp_version; 105 108 set_site_transient( 'update_core', $updates); 106 109 } … … 119 122 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 120 123 */ 121 124 function wp_update_plugins() { 122 global $wp_version;125 include ABSPATH . WPINC . '/version.php'; // for an unmodified $wp_version 123 126 124 127 if ( defined('WP_INSTALLING') ) 125 128 return false; … … 204 207 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 205 208 */ 206 209 function wp_update_themes( ) { 207 global $wp_version;210 include ABSPATH . WPINC . '/version.php'; // for an unmodified $wp_version 208 211 209 212 if ( defined( 'WP_INSTALLING' ) ) 210 213 return false;