diff --git a/wp-admin/load-scripts.php b/wp-admin/load-scripts.php index 8dfe3b18ad..528fbcdc18 100644 --- a/wp-admin/load-scripts.php +++ b/wp-admin/load-scripts.php @@ -3,7 +3,7 @@ /** * Disable error reporting * - * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging + * Set this to error_reporting( -1 ) for debugging */ error_reporting(0); diff --git a/wp-admin/load-styles.php b/wp-admin/load-styles.php index 2c3c5fb93b..716592344e 100644 --- a/wp-admin/load-styles.php +++ b/wp-admin/load-styles.php @@ -3,7 +3,7 @@ /** * Disable error reporting * - * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging + * Set this to error_reporting( -1 ) for debugging */ error_reporting(0); diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 1866964339..f222da4a73 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -24,44 +24,15 @@ define('WP_SETUP_CONFIG', true); /** * Disable error reporting * - * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging + * Set this to error_reporting( -1 ) for debugging */ -error_reporting(0); +error_reporting(-1); -/**#@+ - * These three defines are required to allow us to use require_wp_db() to load - * the database class while being wp-content/db.php aware. - * @ignore - */ -define('ABSPATH', dirname(dirname(__FILE__)).'/'); -define('WPINC', 'wp-includes'); -define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); -define('WP_DEBUG', false); -/**#@-*/ +define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); -require(ABSPATH . WPINC . '/load.php'); -require(ABSPATH . WPINC . '/version.php'); - -// Check for the required PHP version and for the MySQL extension or a database drop-in. -wp_check_php_mysql_versions(); - -require_once(ABSPATH . WPINC . '/functions.php'); - -// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) -wp_load_translations_early(); - -// Turn register_globals off. -wp_unregister_GLOBALS(); - -// Standardize $_SERVER variables across setups. -wp_fix_server_vars(); - -require_once(ABSPATH . WPINC . '/compat.php'); -require_once(ABSPATH . WPINC . '/class-wp-error.php'); -require_once(ABSPATH . WPINC . '/formatting.php'); - -// Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) -wp_magic_quotes(); +require_once( ABSPATH . 'wp-includes/plugin.php' ); +add_action( 'plugins_loaded', 'wp_load_translations_early' ); +require( ABSPATH . 'wp-settings.php' ); // Support wp-config-sample.php one level up, for the develop repo. if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) @@ -120,7 +91,11 @@ switch($step) {
  • -

    wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php." ); ?>

    +

    + wp-config.php file.' ); ?> + wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php." ); ?> + We got it." ); ?> +

    @@ -191,29 +166,25 @@ switch($step) { define('DB_HOST', $dbhost); /**#@-*/ - // We'll fail here if the values are no good. + // Re-construct $wpdb with these new values. + unset( $wpdb ); require_wp_db(); + + // The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must + // fire this manually. We'll fail here if the values are no good. + $wpdb->db_connect(); + if ( ! empty( $wpdb->error ) ) wp_die( $wpdb->error->get_error_message() . $tryagain_link ); // Fetch or generate keys and salts. $no_api = isset( $_POST['noapi'] ); if ( ! $no_api ) { - require_once( ABSPATH . WPINC . '/class-http.php' ); - require_once( ABSPATH . WPINC . '/http.php' ); - /**#@+ - * @ignore - */ - function get_bloginfo() { - return wp_guess_url(); - } - /**#@-*/ $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); } if ( $no_api || is_wp_error( $secret_keys ) ) { $secret_keys = array(); - require_once( ABSPATH . WPINC . '/pluggable.php' ); for ( $i = 0; $i < 8; $i++ ) { $secret_keys[] = wp_generate_password( 64, true, true ); } diff --git a/wp-includes/js/tinymce/wp-tinymce.php b/wp-includes/js/tinymce/wp-tinymce.php index 03abd2d9de..d839c11f85 100644 --- a/wp-includes/js/tinymce/wp-tinymce.php +++ b/wp-includes/js/tinymce/wp-tinymce.php @@ -2,7 +2,7 @@ /** * Disable error reporting * - * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging + * Set this to error_reporting( -1 ) for debugging */ error_reporting(0); diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 7366172101..6f3e46ef2a 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -604,6 +604,11 @@ class wpdb { $this->dbname = $dbname; $this->dbhost = $dbhost; + // wp-config.php creation will manually connect when ready. + if ( defined( 'WP_SETUP_CONFIG' ) ) { + return; + } + $this->db_connect(); } diff --git a/wp-load.php b/wp-load.php index fb859533c3..24cae89978 100644 --- a/wp-load.php +++ b/wp-load.php @@ -38,12 +38,7 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) { // A config file doesn't exist define( 'WPINC', 'wp-includes' ); - define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); require_once( ABSPATH . WPINC . '/load.php' ); - require_once( ABSPATH . WPINC . '/version.php' ); - - wp_check_php_mysql_versions(); - wp_load_translations_early(); // Standardize $_SERVER variables across setups. wp_fix_server_vars(); @@ -52,6 +47,21 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) { $path = wp_guess_url() . '/wp-admin/setup-config.php'; + /* We're going to redirect to setup-config.php. While this shouldn't result + * in an infinite loop, that's a silly thing to assume, don't you think? If + * we're traveling in circles, our last-ditch effort is "Need more help?" + */ + if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) { + header( 'Location: ' . $path ); + exit; + } + + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); + require_once( ABSPATH . WPINC . '/version.php' ); + + wp_check_php_mysql_versions(); + wp_load_translations_early(); + // Die with an error message $die = __( "There doesn't seem to be a wp-config.php file. I need this before we can get started." ) . '

    '; $die .= '

    ' . __( "Need more help? We got it." ) . '

    ';