From ad1e1df0f2274eff12e6dd6eb70893a7b2090d28 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 29 Jun 2011 16:46:46 +0000 Subject: [PATCH] wp_check_php_mysql_versions() during setup and install. see #17934. git-svn-id: http://svn.automattic.com/wordpress/trunk@18374 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/setup-config.php | 10 +++------- wp-includes/load.php | 5 +++++ wp-load.php | 5 +++++ wp-settings.php | 6 +++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 244cdc45d7..4a4c67cbcb 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -40,10 +40,12 @@ define('WP_DEBUG', false); /**#@-*/ require_once(ABSPATH . WPINC . '/load.php'); +require_once(ABSPATH . WPINC . '/version.php'); +wp_check_php_mysql_versions(); + require_once(ABSPATH . WPINC . '/compat.php'); require_once(ABSPATH . WPINC . '/functions.php'); require_once(ABSPATH . WPINC . '/class-wp-error.php'); -require_once(ABSPATH . WPINC . '/version.php'); if (!file_exists(ABSPATH . 'wp-config-sample.php')) wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); @@ -58,12 +60,6 @@ if (file_exists(ABSPATH . 'wp-config.php')) if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php')) wp_die("

The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now.

"); -if ( version_compare( $required_php_version, phpversion(), '>' ) ) - wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress requires at least %2$s.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) ); - -if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') ) - wp_die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); - if (isset($_GET['step'])) $step = $_GET['step']; else diff --git a/wp-includes/load.php b/wp-includes/load.php index 1b06f37e28..73c9eb8aae 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -2,6 +2,8 @@ /** * These functions are needed to load WordPress. * + * This file must be parsable by PHP4. + * * @package WordPress */ @@ -95,6 +97,9 @@ function wp_fix_server_vars() { * * Dies if requirements are not met. * + * This function must be able to work without a complete environment set up. In wp-load.php, for + * example, WP_CONTENT_DIR is defined and version.php is included before this function is called. + * * @access private * @since 3.0.0 */ diff --git a/wp-load.php b/wp-load.php index 45c5689771..246e944fc8 100644 --- a/wp-load.php +++ b/wp-load.php @@ -41,6 +41,11 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) { else $path = 'wp-admin/'; + require_once( ABSPATH . '/wp-includes/load.php' ); + require_once( ABSPATH . '/wp-includes/version.php' ); + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); + wp_check_php_mysql_versions(); + // Die with an error message require_once( ABSPATH . '/wp-includes/class-wp-error.php' ); require_once( ABSPATH . '/wp-includes/functions.php' ); diff --git a/wp-settings.php b/wp-settings.php index 80eb440f64..e9462e3721 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -23,6 +23,9 @@ require( ABSPATH . WPINC . '/version.php' ); // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. wp_initial_constants( ); +// Check for the required PHP version and for the MySQL extension or a database drop-in. +wp_check_php_mysql_versions(); + // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php. set_magic_quotes_runtime( 0 ); @ini_set( 'magic_quotes_sybase', 0 ); @@ -40,9 +43,6 @@ unset( $wp_filter, $cache_lastcommentmodified ); // Standardize $_SERVER variables across setups. wp_fix_server_vars(); -// Check for the required PHP version and for the MySQL extension or a database drop-in. -wp_check_php_mysql_versions(); - // Check if we have received a request due to missing favicon.ico wp_favicon_request();