[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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( __DIR__ ) . '/wp-load.php'; 19 20 nocache_headers(); 21 22 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 23 24 delete_site_transient( 'update_core' ); 25 26 if ( isset( $_GET['step'] ) ) { 27 $step = $_GET['step']; 28 } else { 29 $step = 0; 30 } 31 32 // Do it. No output. 33 if ( 'upgrade_db' === $step ) { 34 wp_upgrade(); 35 die( '0' ); 36 } 37 38 /** 39 * @global string $wp_version The WordPress version string. 40 * @global string $required_php_version The required PHP version string. 41 * @global string[] $required_php_extensions The names of required PHP extensions. 42 * @global string $required_mysql_version The required MySQL version string. 43 * @global wpdb $wpdb WordPress database abstraction object. 44 */ 45 global $wp_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wpdb; 46 47 $step = (int) $step; 48 49 $php_version = PHP_VERSION; 50 $mysql_version = $wpdb->db_version(); 51 $php_compat = version_compare( $php_version, $required_php_version, '>=' ); 52 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { 53 $mysql_compat = true; 54 } else { 55 $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); 56 } 57 58 $missing_extensions = array(); 59 60 if ( isset( $required_php_extensions ) && is_array( $required_php_extensions ) ) { 61 foreach ( $required_php_extensions as $extension ) { 62 if ( extension_loaded( $extension ) ) { 63 continue; 64 } 65 66 $missing_extensions[] = sprintf( 67 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: The PHP extension name needed. */ 68 __( 'You cannot upgrade because <a href="%1$s">WordPress %2$s</a> requires the %3$s PHP extension.' ), 69 $version_url, 70 $wp_version, 71 $extension 72 ); 73 } 74 } 75 76 header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); 77 ?> 78 <!DOCTYPE html> 79 <html <?php language_attributes(); ?>> 80 <head> 81 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 82 <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> 83 <meta name="robots" content="noindex,nofollow" /> 84 <title><?php _e( 'WordPress › Update' ); ?></title> 85 <?php wp_admin_css( 'install', true ); ?> 86 </head> 87 <body class="wp-core-ui"> 88 <p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p> 89 90 <?php if ( (int) get_option( 'db_version' ) === $wp_db_version || ! is_blog_installed() ) : ?> 91 92 <h1><?php _e( 'No Update Required' ); ?></h1> 93 <p><?php _e( 'Your WordPress database is already up to date!' ); ?></p> 94 <p class="step"><a class="button button-large" href="<?php echo esc_url( get_option( 'home' ) ); ?>/"><?php _e( 'Continue' ); ?></a></p> 95 96 <?php 97 elseif ( ! $php_compat || ! $mysql_compat ) : 98 $version_url = sprintf( 99 /* translators: %s: WordPress version. */ 100 esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ), 101 sanitize_title( $wp_version ) 102 ); 103 104 $php_update_message = '</p><p>' . sprintf( 105 /* translators: %s: URL to Update PHP page. */ 106 __( '<a href="%s">Learn more about updating PHP</a>.' ), 107 esc_url( wp_get_update_php_url() ) 108 ); 109 110 $annotation = wp_get_update_php_annotation(); 111 112 if ( $annotation ) { 113 $php_update_message .= '</p><p><em>' . $annotation . '</em>'; 114 } 115 116 if ( ! $mysql_compat && ! $php_compat ) { 117 $message = sprintf( 118 /* 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. */ 119 __( '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.' ), 120 $version_url, 121 $wp_version, 122 $required_php_version, 123 $required_mysql_version, 124 $php_version, 125 $mysql_version 126 ) . $php_update_message; 127 } elseif ( ! $php_compat ) { 128 $message = sprintf( 129 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */ 130 __( '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.' ), 131 $version_url, 132 $wp_version, 133 $required_php_version, 134 $php_version 135 ) . $php_update_message; 136 } elseif ( ! $mysql_compat ) { 137 $message = sprintf( 138 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */ 139 __( '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.' ), 140 $version_url, 141 $wp_version, 142 $required_mysql_version, 143 $mysql_version 144 ); 145 } 146 147 echo '<p>' . $message . '</p>'; 148 elseif ( count( $missing_extensions ) > 0 ) : 149 echo '<p>' . implode( '</p><p>', $missing_extensions ) . '</p>'; 150 else : 151 switch ( $step ) : 152 case 0: 153 $goback = wp_get_referer(); 154 if ( $goback ) { 155 $goback = sanitize_url( $goback ); 156 $goback = urlencode( $goback ); 157 } 158 ?> 159 <h1><?php _e( 'Database Update Required' ); ?></h1> 160 <p><?php _e( 'WordPress has been updated! Next and final step is to update your database to the newest version.' ); ?></p> 161 <p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> 162 <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> 163 <?php 164 break; 165 case 1: 166 wp_upgrade(); 167 168 $backto = ! empty( $_GET['backto'] ) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; 169 $backto = esc_url( $backto ); 170 $backto = wp_validate_redirect( $backto, __get_option( 'home' ) . '/' ); 171 ?> 172 <h1><?php _e( 'Update Complete' ); ?></h1> 173 <p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> 174 <p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> 175 <?php 176 break; 177 endswitch; 178 endif; 179 ?> 180 </body> 181 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Feb 21 08:20:01 2025 | Cross-referenced by PHPXref |