Make WordPress Core


Ignore:
Timestamp:
07/03/2014 07:56:37 PM (11 years ago)
Author:
nacin
Message:

Simplify the setup-config.php UI flow and load process.

When no configuration file is detected, we now redirect to setup-config.php. This process now uses the WordPress bootstrap, rather than a set of fragile hacks.

fixes #28740.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/setup-config.php

    r28906 r28978  
    2525 * Disable error reporting
    2626 *
    27  * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
    28  */
    29 error_reporting(0);
    30 
    31 /**#@+
    32  * These three defines are required to allow us to use require_wp_db() to load
    33  * the database class while being wp-content/db.php aware.
    34  * @ignore
    35  */
    36 define('ABSPATH', dirname(dirname(__FILE__)).'/');
    37 define('WPINC', 'wp-includes');
    38 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    39 define('WP_DEBUG', false);
    40 /**#@-*/
    41 
    42 require(ABSPATH . WPINC . '/load.php');
    43 require(ABSPATH . WPINC . '/version.php');
    44 
    45 // Check for the required PHP version and for the MySQL extension or a database drop-in.
    46 wp_check_php_mysql_versions();
    47 
    48 require_once(ABSPATH . WPINC . '/functions.php');
    49 
    50 // Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
    51 wp_load_translations_early();
    52 
    53 // Turn register_globals off.
    54 wp_unregister_GLOBALS();
    55 
    56 // Standardize $_SERVER variables across setups.
    57 wp_fix_server_vars();
    58 
    59 require_once(ABSPATH . WPINC . '/compat.php');
    60 require_once(ABSPATH . WPINC . '/class-wp-error.php');
    61 require_once(ABSPATH . WPINC . '/formatting.php');
    62 
    63 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
    64 wp_magic_quotes();
     27 * Set this to error_reporting( -1 ) for debugging
     28 */
     29error_reporting(-1);
     30
     31define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
     32
     33require_once( ABSPATH . 'wp-includes/plugin.php' );
     34add_action( 'plugins_loaded', 'wp_load_translations_early' );
     35require( ABSPATH . 'wp-settings.php' );
    6536
    6637// Support wp-config-sample.php one level up, for the develop repo.
     
    12192    <li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
    12293</ol>
    123 <p><strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong></p>
     94<p>
     95    <?php _e( 'We&#8217;re going to use this information to create a <code>wp-config.php</code> file.' ); ?>
     96    <strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
     97    <?php _e( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ); ?>
     98</p>
    12499<p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
    125100
     
    192167    /**#@-*/
    193168
    194     // We'll fail here if the values are no good.
     169    // Re-construct $wpdb with these new values.
     170    unset( $wpdb );
    195171    require_wp_db();
     172
     173    // The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
     174    // fire this manually. We'll fail here if the values are no good.
     175    $wpdb->db_connect();
     176
    196177    if ( ! empty( $wpdb->error ) )
    197178        wp_die( $wpdb->error->get_error_message() . $tryagain_link );
     
    200181    $no_api = isset( $_POST['noapi'] );
    201182    if ( ! $no_api ) {
    202         require_once( ABSPATH . WPINC . '/class-http.php' );
    203         require_once( ABSPATH . WPINC . '/http.php' );
    204         /**#@+
    205          * @ignore
    206          */
    207         function get_bloginfo() {
    208             return wp_guess_url();
    209         }
    210         /**#@-*/
    211183        $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
    212184    }
     
    214186    if ( $no_api || is_wp_error( $secret_keys ) ) {
    215187        $secret_keys = array();
    216         require_once( ABSPATH . WPINC . '/pluggable.php' );
    217188        for ( $i = 0; $i < 8; $i++ ) {
    218189            $secret_keys[] = wp_generate_password( 64, true, true );
Note: See TracChangeset for help on using the changeset viewer.