wp/wp-admin/install.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    65 	}
    65 	}
    66 	?>
    66 	?>
    67 <!DOCTYPE html>
    67 <!DOCTYPE html>
    68 <html <?php language_attributes(); ?>>
    68 <html <?php language_attributes(); ?>>
    69 <head>
    69 <head>
    70 	<meta name="viewport" content="width=device-width" />
    70 	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    71 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    71 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    72 	<meta name="robots" content="noindex,nofollow" />
    72 	<meta name="robots" content="noindex,nofollow" />
    73 	<title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
    73 	<title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
    74 	<?php wp_admin_css( 'install', true ); ?>
    74 	<?php wp_admin_css( 'install', true ); ?>
    75 </head>
    75 </head>
   230 		'</body></html>'
   230 		'</body></html>'
   231 	);
   231 	);
   232 }
   232 }
   233 
   233 
   234 /**
   234 /**
   235  * @global string $wp_version             The WordPress version string.
   235  * @global string   $wp_version              The WordPress version string.
   236  * @global string $required_php_version   The required PHP version string.
   236  * @global string   $required_php_version    The required PHP version string.
   237  * @global string $required_mysql_version The required MySQL version string.
   237  * @global string[] $required_php_extensions The names of required PHP extensions.
   238  * @global wpdb   $wpdb                   WordPress database abstraction object.
   238  * @global string   $required_mysql_version  The required MySQL version string.
   239  */
   239  * @global wpdb     $wpdb                    WordPress database abstraction object.
   240 global $wp_version, $required_php_version, $required_mysql_version, $wpdb;
   240  */
       
   241 global $wp_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wpdb;
   241 
   242 
   242 $php_version   = PHP_VERSION;
   243 $php_version   = PHP_VERSION;
   243 $mysql_version = $wpdb->db_version();
   244 $mysql_version = $wpdb->db_version();
   244 $php_compat    = version_compare( $php_version, $required_php_version, '>=' );
   245 $php_compat    = version_compare( $php_version, $required_php_version, '>=' );
   245 $mysql_compat  = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
   246 $mysql_compat  = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
   296 if ( ! $mysql_compat || ! $php_compat ) {
   297 if ( ! $mysql_compat || ! $php_compat ) {
   297 	display_header();
   298 	display_header();
   298 	die( '<h1>' . __( 'Requirements Not Met' ) . '</h1><p>' . $compat . '</p></body></html>' );
   299 	die( '<h1>' . __( 'Requirements Not Met' ) . '</h1><p>' . $compat . '</p></body></html>' );
   299 }
   300 }
   300 
   301 
       
   302 if ( isset( $required_php_extensions ) && is_array( $required_php_extensions ) ) {
       
   303 	$missing_extensions = array();
       
   304 
       
   305 	foreach ( $required_php_extensions as $extension ) {
       
   306 		if ( extension_loaded( $extension ) ) {
       
   307 			continue;
       
   308 		}
       
   309 
       
   310 		$missing_extensions[] = sprintf(
       
   311 			/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: The PHP extension name needed. */
       
   312 			__( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires the %3$s PHP extension.' ),
       
   313 			$version_url,
       
   314 			$wp_version,
       
   315 			$extension
       
   316 		);
       
   317 	}
       
   318 
       
   319 	if ( count( $missing_extensions ) > 0 ) {
       
   320 		display_header();
       
   321 		die( '<h1>' . __( 'Requirements Not Met' ) . '</h1><p>' . implode( '</p><p>', $missing_extensions ) . '</p></body></html>' );
       
   322 	}
       
   323 }
       
   324 
   301 if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
   325 if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
   302 	display_header();
   326 	display_header();
   303 	die(
   327 	die(
   304 		'<h1>' . __( 'Configuration Error' ) . '</h1>' .
   328 		'<h1>' . __( 'Configuration Error' ) . '</h1>' .
   305 		'<p>' . sprintf(
   329 		'<p>' . sprintf(