Ticket #16156: 16156.patch
| File 16156.patch, 5.4 KB (added by , 15 years ago) |
|---|
-
wp-admin/update-core.php
115 115 * 116 116 * @return null 117 117 */ 118 function core_upgrade_preamble( ) {118 function core_upgrade_preamble( $update_status ) { 119 119 global $upgrade_error; 120 121 $updates = get_core_updates();122 120 ?> 123 121 <div class="wrap"> 124 122 <?php screen_icon('tools'); ?> 125 123 <h2><?php _e('WordPress Updates'); ?></h2> 126 124 <?php 127 if ( $upgrade_error ) { 128 echo '<div class="error"><p>'; 129 if ( $upgrade_error == 'themes' ) 130 _e('Please select one or more themes to update.'); 131 else 132 _e('Please select one or more plugins to update.'); 133 echo '</p></div>'; 125 if( is_wp_error( $update_status ) ) { 126 echo '<div class="error">'; 127 echo '<p>' . __('Wordpress encountered an error while trying to check for updates: ') . $update_status->get_error_message() . '</p>'; 128 echo '<p><a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Try Again' ) . '</a></p>'; 134 129 } 130 else { 131 if ( $upgrade_error ) { 132 echo '<div class="error"><p>'; 133 if ( $upgrade_error == 'themes' ) 134 _e('Please select one or more themes to update.'); 135 else 136 _e('Please select one or more plugins to update.'); 137 echo '</p></div>'; 138 } 139 140 $updates = get_core_updates(); 135 141 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' ) ) ); 139 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>'; 140 echo '</p>'; 142 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { 143 echo '<h3>'; 144 _e('You have the latest version of WordPress.'); 145 echo '</h3>'; 146 echo '<p><a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check again for new updates.' ) . '</a></p>'; 147 } else { 148 echo '<div class="updated inline"><p>'; 149 _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.'); 150 echo '</p></div>'; 141 151 142 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { 143 echo '<h3>'; 144 _e('You have the latest version of WordPress.'); 145 echo '</h3>'; 146 } else { 147 echo '<div class="updated inline"><p>'; 148 _e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.'); 149 echo '</p></div>'; 152 echo '<h3 class="response">'; 153 _e( 'An updated version of WordPress is available.' ); 154 echo '</h3>'; 155 } 150 156 151 echo '<h3 class="response">'; 152 _e( 'An updated version of WordPress is available.' ); 153 echo '</h3>'; 154 } 157 echo '<ul class="core-updates">'; 158 $alternate = true; 159 foreach( (array) $updates as $update ) { 160 echo '<li>'; 161 list_core_update( $update ); 162 echo '</li>'; 163 } 164 echo '</ul>'; 165 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; 166 dismissed_updates(); 155 167 156 echo '<ul class="core-updates">'; 157 $alternate = true; 158 foreach( (array) $updates as $update ) { 159 echo '<li>'; 160 list_core_update( $update ); 161 echo '</li>'; 168 if ( current_user_can( 'update_plugins' ) ) 169 list_plugin_updates(); 170 if ( current_user_can( 'update_themes' ) ) 171 list_theme_updates(); 162 172 } 163 echo '</ul>';164 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';165 dismissed_updates();166 167 if ( current_user_can( 'update_plugins' ) )168 list_plugin_updates();169 if ( current_user_can( 'update_themes' ) )170 list_theme_updates();171 173 do_action('core_upgrade_preamble'); 172 174 echo '</div>'; 173 175 } … … 409 411 410 412 if ( 'upgrade-core' == $action ) { 411 413 412 wp_version_check();414 $checked_for_updates = wp_version_check(); 413 415 require_once(ABSPATH . 'wp-admin/admin-header.php'); 414 core_upgrade_preamble(); 416 417 core_upgrade_preamble( $checked_for_updates ); 415 418 416 419 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { 417 420 check_admin_referer('upgrade-core'); -
wp-includes/update.php
18 18 * @uses $wp_version Used to check against the newest WordPress version. 19 19 * 20 20 * @return mixed Returns null if update is unsupported. Returns false if check is too soon. 21 * Returns WP_ERROR object if HTTP request failed. Returns true on successful fetch of update information. 21 22 */ 22 23 function wp_version_check() { 23 24 if ( defined('WP_INSTALLING') ) … … 69 70 ); 70 71 71 72 $response = wp_remote_get($url, $options); 72 73 73 74 if ( is_wp_error( $response ) ) 74 return false;75 return $response; 75 76 76 77 if ( 200 != $response['response']['code'] ) 77 78 return false; … … 103 104 $updates->last_checked = time(); 104 105 $updates->version_checked = $wp_version; 105 106 set_site_transient( 'update_core', $updates); 107 return true; 106 108 } 107 109 108 110 /**