author | ymh <ymh.work@gmail.com> |
Wed, 21 Sep 2022 18:19:35 +0200 | |
changeset 18 | be944660c56a |
parent 16 | a86126ab1dd4 |
child 19 | 3d72ae0968f4 |
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 */ |
|
16 | 18 |
require dirname( __DIR__ ) . '/wp-load.php'; |
0 | 19 |
|
20 |
nocache_headers(); |
|
21 |
||
16 | 22 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
0 | 23 |
|
9 | 24 |
delete_site_transient( 'update_core' ); |
0 | 25 |
|
9 | 26 |
if ( isset( $_GET['step'] ) ) { |
0 | 27 |
$step = $_GET['step']; |
9 | 28 |
} else { |
0 | 29 |
$step = 0; |
9 | 30 |
} |
0 | 31 |
|
32 |
// Do it. No output. |
|
33 |
if ( 'upgrade_db' === $step ) { |
|
34 |
wp_upgrade(); |
|
35 |
die( '0' ); |
|
36 |
} |
|
37 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
38 |
/** |
16 | 39 |
* @global string $wp_version The WordPress version string. |
40 |
* @global string $required_php_version The required PHP version string. |
|
41 |
* @global string $required_mysql_version The required MySQL version string. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
*/ |
5 | 43 |
global $wp_version, $required_php_version, $required_mysql_version; |
44 |
||
0 | 45 |
$step = (int) $step; |
46 |
||
9 | 47 |
$php_version = phpversion(); |
48 |
$mysql_version = $wpdb->db_version(); |
|
49 |
$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
50 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
0 | 51 |
$mysql_compat = true; |
9 | 52 |
} else { |
0 | 53 |
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
9 | 54 |
} |
0 | 55 |
|
16 | 56 |
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
0 | 57 |
?> |
58 |
<!DOCTYPE html> |
|
16 | 59 |
<html <?php language_attributes(); ?>> |
0 | 60 |
<head> |
5 | 61 |
<meta name="viewport" content="width=device-width" /> |
0 | 62 |
<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
|
63 |
<meta name="robots" content="noindex,nofollow" /> |
0 | 64 |
<title><?php _e( 'WordPress › Update' ); ?></title> |
16 | 65 |
<?php wp_admin_css( 'install', true ); ?> |
0 | 66 |
</head> |
67 |
<body class="wp-core-ui"> |
|
9 | 68 |
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p> |
0 | 69 |
|
16 | 70 |
<?php if ( (int) get_option( 'db_version' ) === $wp_db_version || ! is_blog_installed() ) : ?> |
0 | 71 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
<h1><?php _e( 'No Update Required' ); ?></h1> |
16 | 73 |
<p><?php _e( 'Your WordPress database is already up to date!' ); ?></p> |
0 | 74 |
<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
75 |
||
9 | 76 |
<?php |
77 |
elseif ( ! $php_compat || ! $mysql_compat ) : |
|
78 |
$version_url = sprintf( |
|
16 | 79 |
/* translators: %s: WordPress version. */ |
9 | 80 |
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
81 |
sanitize_title( $wp_version ) |
|
82 |
); |
|
83 |
||
16 | 84 |
$php_update_message = '</p><p>' . sprintf( |
18 | 85 |
/* translators: %s: URL to Update PHP page. */ |
16 | 86 |
__( '<a href="%s">Learn more about updating PHP</a>.' ), |
87 |
esc_url( wp_get_update_php_url() ) |
|
88 |
); |
|
9 | 89 |
|
90 |
$annotation = wp_get_update_php_annotation(); |
|
16 | 91 |
|
9 | 92 |
if ( $annotation ) { |
93 |
$php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
|
94 |
} |
|
95 |
||
96 |
if ( ! $mysql_compat && ! $php_compat ) { |
|
16 | 97 |
$message = sprintf( |
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; |
|
9 | 107 |
} elseif ( ! $php_compat ) { |
16 | 108 |
$message = sprintf( |
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; |
|
9 | 116 |
} elseif ( ! $mysql_compat ) { |
16 | 117 |
$message = sprintf( |
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 |
); |
|
9 | 125 |
} |
126 |
||
127 |
echo '<p>' . $message . '</p>'; |
|
128 |
?> |
|
129 |
<?php |
|
130 |
else : |
|
131 |
switch ( $step ) : |
|
132 |
case 0: |
|
133 |
$goback = wp_get_referer(); |
|
134 |
if ( $goback ) { |
|
135 |
$goback = esc_url_raw( $goback ); |
|
136 |
$goback = urlencode( $goback ); |
|
137 |
} |
|
138 |
?> |
|
139 |
<h1><?php _e( 'Database Update Required' ); ?></h1> |
|
0 | 140 |
<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
|
141 |
<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
|
142 |
<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 | 143 |
<?php |
144 |
break; |
|
145 |
case 1: |
|
146 |
wp_upgrade(); |
|
0 | 147 |
|
9 | 148 |
$backto = ! empty( $_GET['backto'] ) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
0 | 149 |
$backto = esc_url( $backto ); |
9 | 150 |
$backto = wp_validate_redirect( $backto, __get_option( 'home' ) . '/' ); |
151 |
?> |
|
152 |
<h1><?php _e( 'Update Complete' ); ?></h1> |
|
0 | 153 |
<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> |
154 |
<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> |
|
9 | 155 |
<?php |
156 |
break; |
|
0 | 157 |
endswitch; |
158 |
endif; |
|
159 |
?> |
|
160 |
</body> |
|
161 |
</html> |