author | ymh <ymh.work@gmail.com> |
Tue, 15 Oct 2019 11:56:20 +0200 | |
changeset 12 | d8a8807227e4 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 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 |
*/ |
|
15 |
define( 'WP_INSTALLING', true ); |
|
16 |
||
17 |
/** Load WordPress Bootstrap */ |
|
18 |
require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
19 |
||
20 |
nocache_headers(); |
|
21 |
||
22 |
timer_start(); |
|
23 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
24 |
||
9 | 25 |
delete_site_transient( 'update_core' ); |
0 | 26 |
|
9 | 27 |
if ( isset( $_GET['step'] ) ) { |
0 | 28 |
$step = $_GET['step']; |
9 | 29 |
} else { |
0 | 30 |
$step = 0; |
9 | 31 |
} |
0 | 32 |
|
33 |
// Do it. No output. |
|
34 |
if ( 'upgrade_db' === $step ) { |
|
35 |
wp_upgrade(); |
|
36 |
die( '0' ); |
|
37 |
} |
|
38 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
39 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
* @global string $wp_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
41 |
* @global string $required_php_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
* @global string $required_mysql_version |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
43 |
*/ |
5 | 44 |
global $wp_version, $required_php_version, $required_mysql_version; |
45 |
||
0 | 46 |
$step = (int) $step; |
47 |
||
9 | 48 |
$php_version = phpversion(); |
49 |
$mysql_version = $wpdb->db_version(); |
|
50 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
51 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
0 | 52 |
$mysql_compat = true; |
9 | 53 |
} else { |
0 | 54 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
9 | 55 |
} |
0 | 56 |
|
57 |
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
|
58 |
?> |
|
59 |
<!DOCTYPE html> |
|
60 |
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
|
61 |
<head> |
|
5 | 62 |
<meta name="viewport" content="width=device-width" /> |
0 | 63 |
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
<meta name="robots" content="noindex,nofollow" /> |
0 | 65 |
<title><?php _e( 'WordPress › Update' ); ?></title> |
66 |
<?php |
|
67 |
wp_admin_css( 'install', true ); |
|
68 |
wp_admin_css( 'ie', true ); |
|
69 |
?> |
|
70 |
</head> |
|
71 |
<body class="wp-core-ui"> |
|
9 | 72 |
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p> |
0 | 73 |
|
9 | 74 |
<?php if ( get_option( 'db_version' ) == $wp_db_version || ! is_blog_installed() ) : ?> |
0 | 75 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
<h1><?php _e( 'No Update Required' ); ?></h1> |
0 | 77 |
<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> |
|
79 |
||
9 | 80 |
<?php |
81 |
elseif ( ! $php_compat || ! $mysql_compat ) : |
|
82 |
$version_url = sprintf( |
|
83 |
/* translators: %s: WordPress version */ |
|
84 |
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
|
85 |
sanitize_title( $wp_version ) |
|
86 |
); |
|
87 |
||
88 |
/* translators: %s: Update PHP page URL */ |
|
89 |
$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); |
|
90 |
||
91 |
$annotation = wp_get_update_php_annotation(); |
|
92 |
if ( $annotation ) { |
|
93 |
$php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
94 |
} |
|
95 |
||
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 */ |
|
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; |
|
99 |
} 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 */ |
|
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; |
|
102 |
} 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 */ |
|
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 ); |
|
105 |
} |
|
106 |
||
107 |
echo '<p>' . $message . '</p>'; |
|
108 |
?> |
|
109 |
<?php |
|
110 |
else : |
|
111 |
switch ( $step ) : |
|
112 |
case 0: |
|
113 |
$goback = wp_get_referer(); |
|
114 |
if ( $goback ) { |
|
115 |
$goback = esc_url_raw( $goback ); |
|
116 |
$goback = urlencode( $goback ); |
|
117 |
} |
|
118 |
?> |
|
119 |
<h1><?php _e( 'Database Update Required' ); ?></h1> |
|
0 | 120 |
<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> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
<p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p> |
9 | 123 |
<?php |
124 |
break; |
|
125 |
case 1: |
|
126 |
wp_upgrade(); |
|
0 | 127 |
|
9 | 128 |
$backto = ! empty( $_GET['backto'] ) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
0 | 129 |
$backto = esc_url( $backto ); |
9 | 130 |
$backto = wp_validate_redirect( $backto, __get_option( 'home' ) . '/' ); |
131 |
?> |
|
132 |
<h1><?php _e( 'Update Complete' ); ?></h1> |
|
0 | 133 |
<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> |
|
135 |
||
136 |
<!-- |
|
137 |
<pre> |
|
9 | 138 |
<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?> |
0 | 139 |
|
9 | 140 |
<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?> |
0 | 141 |
</pre> |
142 |
--> |
|
143 |
||
9 | 144 |
<?php |
145 |
break; |
|
0 | 146 |
endswitch; |
147 |
endif; |
|
148 |
?> |
|
149 |
</body> |
|
150 |
</html> |