X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..245e789b234afa4525862e7a6e5e3c2e7a52ef20:/wp-admin/setup-config.php diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 6201b004..2b5b7f89 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -13,8 +13,6 @@ /** * We are installing. - * - * @package WordPress */ define('WP_INSTALLING', true); @@ -44,15 +42,20 @@ define('WP_DEBUG', false); require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/version.php'); -// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) -wp_load_translations_early(); - // 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'); @@ -60,11 +63,14 @@ require_once(ABSPATH . WPINC . '/formatting.php'); // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) wp_magic_quotes(); -if ( ! file_exists( ABSPATH . 'wp-config-sample.php' ) ) +// Support wp-config-sample.php one level up, for the develop repo. +if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) + $config_file = file( ABSPATH . 'wp-config-sample.php' ); +elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) + $config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' ); +else wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) ); -$config_file = file(ABSPATH . 'wp-config-sample.php'); - // Check if wp-config.php has been created if ( file_exists( ABSPATH . 'wp-config.php' ) ) wp_die( '

' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now." ), 'install.php' ) . '

' ); @@ -80,10 +86,8 @@ $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; * * @ignore * @since 2.3.0 - * @package WordPress - * @subpackage Installer_WP_Config */ -function display_header() { +function setup_config_display_header() { global $wp_version; header( 'Content-Type: text/html; charset=utf-8' ); @@ -91,19 +95,21 @@ function display_header() { > + <?php _e( 'WordPress › Setup Configuration File' ); ?> + -> -

WordPress

+ +

@@ -114,18 +120,18 @@ switch($step) {
  • -

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

    +

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

    -

    +

    -

    +

    @@ -154,16 +160,16 @@ switch($step) {
    -

    +

    ' . __( 'Try Again' ) . ''; + $tryagain_link = '

    ' . __( 'Try again' ) . ''; if ( empty( $prefix ) ) wp_die( __( 'ERROR: "Table Prefix" must not be empty.' . $tryagain_link ) ); @@ -192,12 +198,11 @@ switch($step) { if ( ! $no_api ) { require_once( ABSPATH . WPINC . '/class-http.php' ); require_once( ABSPATH . WPINC . '/http.php' ); - wp_fix_server_vars(); /**#@+ * @ignore */ function get_bloginfo() { - return ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' ) ); + return wp_guess_url(); } /**#@-*/ $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); @@ -217,9 +222,10 @@ switch($step) { } $key = 0; - foreach ( $config_file as &$line ) { + // Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4. + foreach ( $config_file as $line_num => $line ) { if ( '$table_prefix =' == substr( $line, 0, 16 ) ) { - $line = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; + $config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; continue; } @@ -234,7 +240,7 @@ switch($step) { case 'DB_USER' : case 'DB_PASSWORD' : case 'DB_HOST' : - $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; + $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; break; case 'AUTH_KEY' : case 'SECURE_AUTH_KEY' : @@ -244,37 +250,51 @@ switch($step) { case 'SECURE_AUTH_SALT' : case 'LOGGED_IN_SALT' : case 'NONCE_SALT' : - $line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n"; + $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n"; break; } } unset( $line ); if ( ! is_writable(ABSPATH) ) : - display_header(); + setup_config_display_header(); ?> -

    wp-config.php file." ); ?>

    +

    wp-config.php file." ); ?>

    wp-config.php manually and paste the following text into it.' ); ?>

    - -

    -

    +

    +

    + -

    +

    -

    +