| 1 | Index: wp-admin/admin.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/admin.php (revision 18542) |
|---|
| 4 | +++ wp-admin/admin.php (working copy) |
|---|
| 5 | @@ -31,33 +31,29 @@ |
|---|
| 6 | |
|---|
| 7 | if ( get_option('db_upgraded') ) { |
|---|
| 8 | $wp_rewrite->flush_rules(); |
|---|
| 9 | - update_option( 'db_upgraded', false ); |
|---|
| 10 | + update_option( 'db_upgraded', false ); |
|---|
| 11 | |
|---|
| 12 | - /** |
|---|
| 13 | - * Runs on the next page load after successful upgrade |
|---|
| 14 | - * |
|---|
| 15 | - * @since 2.8 |
|---|
| 16 | - */ |
|---|
| 17 | - do_action('after_db_upgrade'); |
|---|
| 18 | -} elseif ( get_option('db_version') != $wp_db_version ) { |
|---|
| 19 | - if ( !is_multisite() ) { |
|---|
| 20 | - wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); |
|---|
| 21 | + // Runs on the next page load after successful upgrade |
|---|
| 22 | + do_action( 'after_db_upgrade' ); |
|---|
| 23 | + |
|---|
| 24 | +} elseif ( get_option( 'db_version' ) != $wp_db_version ) { |
|---|
| 25 | + if ( ! is_multisite() ) { |
|---|
| 26 | + define( 'WP_INSTALLING', true ); |
|---|
| 27 | + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|---|
| 28 | + delete_site_transient( 'update_core' ); |
|---|
| 29 | + wp_upgrade(); |
|---|
| 30 | + wp_redirect( $_SERVER['REQUEST_URI'] ); |
|---|
| 31 | exit; |
|---|
| 32 | } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { |
|---|
| 33 | - /** |
|---|
| 34 | - * On really small MU installs run the upgrader every time, |
|---|
| 35 | - * else run it less often to reduce load. |
|---|
| 36 | - * |
|---|
| 37 | - * @since 2.8.4b |
|---|
| 38 | - */ |
|---|
| 39 | + // On really small MU installs run the upgrader every time, |
|---|
| 40 | + // else run it less often to reduce load. |
|---|
| 41 | $c = get_blog_count(); |
|---|
| 42 | - if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) { |
|---|
| 43 | + if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) == 1 ) ) { |
|---|
| 44 | require_once( ABSPATH . WPINC . '/http.php' ); |
|---|
| 45 | - $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) ); |
|---|
| 46 | - do_action( 'after_mu_upgrade', $response ); |
|---|
| 47 | - unset($response); |
|---|
| 48 | + wp_upgrade(); |
|---|
| 49 | + do_action( 'after_mu_upgrade', '' ); |
|---|
| 50 | } |
|---|
| 51 | - unset($c); |
|---|
| 52 | + unset( $c ); |
|---|
| 53 | } |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | Index: wp-admin/upgrade.php |
|---|
| 57 | =================================================================== |
|---|
| 58 | --- wp-admin/upgrade.php (revision 18542) |
|---|
| 59 | +++ wp-admin/upgrade.php (working copy) |
|---|
| 60 | @@ -17,94 +17,12 @@ |
|---|
| 61 | /** Load WordPress Bootstrap */ |
|---|
| 62 | require( '../wp-load.php' ); |
|---|
| 63 | |
|---|
| 64 | -timer_start(); |
|---|
| 65 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|---|
| 66 | +delete_site_transient( 'update_core' ); |
|---|
| 67 | |
|---|
| 68 | -delete_site_transient('update_core'); |
|---|
| 69 | - |
|---|
| 70 | -if ( isset( $_GET['step'] ) ) |
|---|
| 71 | - $step = $_GET['step']; |
|---|
| 72 | -else |
|---|
| 73 | - $step = 0; |
|---|
| 74 | - |
|---|
| 75 | -// Do it. No output. |
|---|
| 76 | -if ( 'upgrade_db' === $step ) { |
|---|
| 77 | - wp_upgrade(); |
|---|
| 78 | +wp_upgrade(); |
|---|
| 79 | +if ( 'upgrade_db' === $_GET['step'] ) |
|---|
| 80 | die( '0' ); |
|---|
| 81 | -} |
|---|
| 82 | |
|---|
| 83 | -$step = (int) $step; |
|---|
| 84 | - |
|---|
| 85 | -$php_version = phpversion(); |
|---|
| 86 | -$mysql_version = $wpdb->db_version(); |
|---|
| 87 | -$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|---|
| 88 | -$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
|---|
| 89 | - |
|---|
| 90 | -@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
|---|
| 91 | -?> |
|---|
| 92 | -<!DOCTYPE html> |
|---|
| 93 | -<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
|---|
| 94 | -<head> |
|---|
| 95 | - <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> |
|---|
| 96 | - <title><?php _e( 'WordPress › Update' ); ?></title> |
|---|
| 97 | - <?php |
|---|
| 98 | - wp_admin_css( 'install', true ); |
|---|
| 99 | - wp_admin_css( 'ie', true ); |
|---|
| 100 | - ?> |
|---|
| 101 | -</head> |
|---|
| 102 | -<body> |
|---|
| 103 | -<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1> |
|---|
| 104 | - |
|---|
| 105 | -<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?> |
|---|
| 106 | - |
|---|
| 107 | -<h2><?php _e( 'No Update Required' ); ?></h2> |
|---|
| 108 | -<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p> |
|---|
| 109 | -<p class="step"><a class="button" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
|---|
| 110 | - |
|---|
| 111 | -<?php elseif ( !$php_compat || !$mysql_compat ) : |
|---|
| 112 | - if ( !$mysql_compat && !$php_compat ) |
|---|
| 113 | - printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|---|
| 114 | - elseif ( !$php_compat ) |
|---|
| 115 | - printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|---|
| 116 | - elseif ( !$mysql_compat ) |
|---|
| 117 | - printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|---|
| 118 | -?> |
|---|
| 119 | -<?php else : |
|---|
| 120 | -switch ( $step ) : |
|---|
| 121 | - case 0: |
|---|
| 122 | - $goback = stripslashes( wp_get_referer() ); |
|---|
| 123 | - $goback = esc_url_raw( $goback ); |
|---|
| 124 | - $goback = urlencode( $goback ); |
|---|
| 125 | -?> |
|---|
| 126 | -<h2><?php _e( 'Database Update Required' ); ?></h2> |
|---|
| 127 | -<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p> |
|---|
| 128 | -<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p> |
|---|
| 129 | -<p class="step"><a class="button" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p> |
|---|
| 130 | -<?php |
|---|
| 131 | - break; |
|---|
| 132 | - case 1: |
|---|
| 133 | - wp_upgrade(); |
|---|
| 134 | - |
|---|
| 135 | - $backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
|---|
| 136 | - $backto = esc_url( $backto ); |
|---|
| 137 | - $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); |
|---|
| 138 | -?> |
|---|
| 139 | -<h2><?php _e( 'Update Complete' ); ?></h2> |
|---|
| 140 | - <p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> |
|---|
| 141 | - <p class="step"><a class="button" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> |
|---|
| 142 | - |
|---|
| 143 | -<!-- |
|---|
| 144 | -<pre> |
|---|
| 145 | -<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?> |
|---|
| 146 | - |
|---|
| 147 | -<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?> |
|---|
| 148 | -</pre> |
|---|
| 149 | ---> |
|---|
| 150 | - |
|---|
| 151 | -<?php |
|---|
| 152 | - break; |
|---|
| 153 | -endswitch; |
|---|
| 154 | -endif; |
|---|
| 155 | -?> |
|---|
| 156 | -</body> |
|---|
| 157 | -</html> |
|---|
| 158 | +wp_safe_redirect( wp_get_referer() ); |
|---|
| 159 | +exit; |
|---|
| 160 | \ No newline at end of file |
|---|