PageRenderTime 48ms CodeModel.GetById 38ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-admin/upgrade.php

https://gitlab.com/math4youbyusgroupillinois/WordPress
PHP | 118 lines | 86 code | 18 blank | 14 comment | 12 complexity | 0e4347176e5d7f0d5da1f81a9e1ff9ad MD5 | raw file
  1<?php
  2/**
  3 * Upgrade WordPress Page.
  4 *
  5 * @package WordPress
  6 * @subpackage Administration
  7 */
  8
  9/**
 10 * We are upgrading WordPress.
 11 *
 12 * @since 1.5.1
 13 * @var bool
 14 */
 15define( 'WP_INSTALLING', true );
 16
 17/** Load WordPress Bootstrap */
 18require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
 19
 20nocache_headers();
 21
 22timer_start();
 23require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 24
 25delete_site_transient('update_core');
 26
 27if ( isset( $_GET['step'] ) )
 28	$step = $_GET['step'];
 29else
 30	$step = 0;
 31
 32// Do it. No output.
 33if ( 'upgrade_db' === $step ) {
 34	wp_upgrade();
 35	die( '0' );
 36}
 37
 38global $wp_version, $required_php_version, $required_mysql_version;
 39
 40$step = (int) $step;
 41
 42$php_version    = phpversion();
 43$mysql_version  = $wpdb->db_version();
 44$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
 45if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
 46	$mysql_compat = true;
 47else
 48	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
 49
 50@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
 51?>
 52<!DOCTYPE html>
 53<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
 54<head>
 55	<meta name="viewport" content="width=device-width" />
 56	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
 57	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
 58	<?php
 59	wp_admin_css( 'install', true );
 60	wp_admin_css( 'ie', true );
 61	?>
 62</head>
 63<body class="wp-core-ui">
 64<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
 65
 66<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
 67
 68<h2><?php _e( 'No Update Required' ); ?></h2>
 69<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
 70<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
 71
 72<?php elseif ( !$php_compat || !$mysql_compat ) :
 73	if ( !$mysql_compat && !$php_compat )
 74		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 );
 75	elseif ( !$php_compat )
 76		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 );
 77	elseif ( !$mysql_compat )
 78		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 );
 79?>
 80<?php else :
 81switch ( $step ) :
 82	case 0:
 83		$goback = wp_get_referer();
 84		$goback = esc_url_raw( $goback );
 85		$goback = urlencode( $goback );
 86?>
 87<h2><?php _e( 'Database Update Required' ); ?></h2>
 88<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>
 89<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p>
 90<p class="step"><a class="button button-large" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p>
 91<?php
 92		break;
 93	case 1:
 94		wp_upgrade();
 95
 96			$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
 97			$backto = esc_url( $backto );
 98			$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
 99?>
100<h2><?php _e( 'Update Complete' ); ?></h2>
101	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
102	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
103
104<!--
105<pre>
106<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
107
108<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
109</pre>
110-->
111
112<?php
113		break;
114endswitch;
115endif;
116?>
117</body>
118</html>