PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-admin/upgrade.php

https://bitbucket.org/acipriani/madeinapulia.com
PHP | 116 lines | 85 code | 17 blank | 14 comment | 12 complexity | f074a2f1a20c9aee61f75af61e2c1994 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
 38$step = (int) $step;
 39
 40$php_version    = phpversion();
 41$mysql_version  = $wpdb->db_version();
 42$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
 43if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
 44	$mysql_compat = true;
 45else
 46	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
 47
 48@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
 49?>
 50<!DOCTYPE html>
 51<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
 52<head>
 53	<meta name="viewport" content="width=device-width" />
 54	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
 55	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
 56	<?php
 57	wp_admin_css( 'install', true );
 58	wp_admin_css( 'ie', true );
 59	?>
 60</head>
 61<body class="wp-core-ui">
 62<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
 63
 64<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
 65
 66<h2><?php _e( 'No Update Required' ); ?></h2>
 67<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
 68<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
 69
 70<?php elseif ( !$php_compat || !$mysql_compat ) :
 71	if ( !$mysql_compat && !$php_compat )
 72		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 );
 73	elseif ( !$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. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
 75	elseif ( !$mysql_compat )
 76		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 );
 77?>
 78<?php else :
 79switch ( $step ) :
 80	case 0:
 81		$goback = wp_get_referer();
 82		$goback = esc_url_raw( $goback );
 83		$goback = urlencode( $goback );
 84?>
 85<h2><?php _e( 'Database Update Required' ); ?></h2>
 86<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>
 87<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p>
 88<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>
 89<?php
 90		break;
 91	case 1:
 92		wp_upgrade();
 93
 94			$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
 95			$backto = esc_url( $backto );
 96			$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
 97?>
 98<h2><?php _e( 'Update Complete' ); ?></h2>
 99	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
100	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
101
102<!--
103<pre>
104<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
105
106<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
107</pre>
108-->
109
110<?php
111		break;
112endswitch;
113endif;
114?>
115</body>
116</html>