wp/wp-admin/upgrade.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    13  * @var bool
    13  * @var bool
    14  */
    14  */
    15 define( 'WP_INSTALLING', true );
    15 define( 'WP_INSTALLING', true );
    16 
    16 
    17 /** Load WordPress Bootstrap */
    17 /** Load WordPress Bootstrap */
    18 require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
    18 require dirname( __DIR__ ) . '/wp-load.php';
    19 
    19 
    20 nocache_headers();
    20 nocache_headers();
    21 
    21 
    22 timer_start();
    22 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    23 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
       
    24 
    23 
    25 delete_site_transient( 'update_core' );
    24 delete_site_transient( 'update_core' );
    26 
    25 
    27 if ( isset( $_GET['step'] ) ) {
    26 if ( isset( $_GET['step'] ) ) {
    28 	$step = $_GET['step'];
    27 	$step = $_GET['step'];
    35 	wp_upgrade();
    34 	wp_upgrade();
    36 	die( '0' );
    35 	die( '0' );
    37 }
    36 }
    38 
    37 
    39 /**
    38 /**
    40  * @global string $wp_version
    39  * @global string $wp_version             The WordPress version string.
    41  * @global string $required_php_version
    40  * @global string $required_php_version   The required PHP version string.
    42  * @global string $required_mysql_version
    41  * @global string $required_mysql_version The required MySQL version string.
    43  */
    42  */
    44 global $wp_version, $required_php_version, $required_mysql_version;
    43 global $wp_version, $required_php_version, $required_mysql_version;
    45 
    44 
    46 $step = (int) $step;
    45 $step = (int) $step;
    47 
    46 
    52 	$mysql_compat = true;
    51 	$mysql_compat = true;
    53 } else {
    52 } else {
    54 	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
    53 	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
    55 }
    54 }
    56 
    55 
    57 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
    56 header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
    58 ?>
    57 ?>
    59 <!DOCTYPE html>
    58 <!DOCTYPE html>
    60 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    59 <html <?php language_attributes(); ?>>
    61 <head>
    60 <head>
    62 	<meta name="viewport" content="width=device-width" />
    61 	<meta name="viewport" content="width=device-width" />
    63 	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
    62 	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
    64 	<meta name="robots" content="noindex,nofollow" />
    63 	<meta name="robots" content="noindex,nofollow" />
    65 	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
    64 	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
    66 	<?php
    65 	<?php wp_admin_css( 'install', true ); ?>
    67 	wp_admin_css( 'install', true );
       
    68 	wp_admin_css( 'ie', true );
       
    69 	?>
       
    70 </head>
    66 </head>
    71 <body class="wp-core-ui">
    67 <body class="wp-core-ui">
    72 <p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p>
    68 <p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p>
    73 
    69 
    74 <?php if ( get_option( 'db_version' ) == $wp_db_version || ! is_blog_installed() ) : ?>
    70 <?php if ( (int) get_option( 'db_version' ) === $wp_db_version || ! is_blog_installed() ) : ?>
    75 
    71 
    76 <h1><?php _e( 'No Update Required' ); ?></h1>
    72 <h1><?php _e( 'No Update Required' ); ?></h1>
    77 <p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
    73 <p><?php _e( 'Your WordPress database is already up to date!' ); ?></p>
    78 <p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
    74 <p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
    79 
    75 
    80 	<?php
    76 	<?php
    81 elseif ( ! $php_compat || ! $mysql_compat ) :
    77 elseif ( ! $php_compat || ! $mysql_compat ) :
    82 	$version_url = sprintf(
    78 	$version_url = sprintf(
    83 		/* translators: %s: WordPress version */
    79 		/* translators: %s: WordPress version. */
    84 		esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
    80 		esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
    85 		sanitize_title( $wp_version )
    81 		sanitize_title( $wp_version )
    86 	);
    82 	);
    87 
    83 
    88 	/* translators: %s: Update PHP page URL */
    84 	/* translators: %s: URL to Update PHP page. */
    89 	$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) );
    85 	$php_update_message = '</p><p>' . sprintf(
       
    86 		__( '<a href="%s">Learn more about updating PHP</a>.' ),
       
    87 		esc_url( wp_get_update_php_url() )
       
    88 	);
    90 
    89 
    91 	$annotation = wp_get_update_php_annotation();
    90 	$annotation = wp_get_update_php_annotation();
       
    91 
    92 	if ( $annotation ) {
    92 	if ( $annotation ) {
    93 		$php_update_message .= '</p><p><em>' . $annotation . '</em>';
    93 		$php_update_message .= '</p><p><em>' . $annotation . '</em>';
    94 	}
    94 	}
    95 
    95 
    96 	if ( ! $mysql_compat && ! $php_compat ) {
    96 	if ( ! $mysql_compat && ! $php_compat ) {
    97 		/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */
    97 		$message = sprintf(
    98 		$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) . $php_update_message;
    98 			/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
       
    99 			__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ),
       
   100 			$version_url,
       
   101 			$wp_version,
       
   102 			$required_php_version,
       
   103 			$required_mysql_version,
       
   104 			$php_version,
       
   105 			$mysql_version
       
   106 		) . $php_update_message;
    99 	} elseif ( ! $php_compat ) {
   107 	} elseif ( ! $php_compat ) {
   100 		/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */
   108 		$message = sprintf(
   101 		$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_php_version, $php_version ) . $php_update_message;
   109 			/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */
       
   110 			__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ),
       
   111 			$version_url,
       
   112 			$wp_version,
       
   113 			$required_php_version,
       
   114 			$php_version
       
   115 		) . $php_update_message;
   102 	} elseif ( ! $mysql_compat ) {
   116 	} elseif ( ! $mysql_compat ) {
   103 		/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */
   117 		$message = sprintf(
   104 		$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_mysql_version, $mysql_version );
   118 			/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */
       
   119 			__( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ),
       
   120 			$version_url,
       
   121 			$wp_version,
       
   122 			$required_mysql_version,
       
   123 			$mysql_version
       
   124 		);
   105 	}
   125 	}
   106 
   126 
   107 	echo '<p>' . $message . '</p>';
   127 	echo '<p>' . $message . '</p>';
   108 	?>
   128 	?>
   109 	<?php
   129 	<?php
   130 			$backto = wp_validate_redirect( $backto, __get_option( 'home' ) . '/' );
   150 			$backto = wp_validate_redirect( $backto, __get_option( 'home' ) . '/' );
   131 			?>
   151 			?>
   132 	<h1><?php _e( 'Update Complete' ); ?></h1>
   152 	<h1><?php _e( 'Update Complete' ); ?></h1>
   133 	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
   153 	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
   134 	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
   154 	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
   135 
       
   136 <!--
       
   137 <pre>
       
   138 			<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
       
   139 
       
   140 			<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
       
   141 </pre>
       
   142 -->
       
   143 
       
   144 			<?php
   155 			<?php
   145 			break;
   156 			break;
   146 endswitch;
   157 endswitch;
   147 endif;
   158 endif;
   148 ?>
   159 ?>