X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..58b0523c599c731e868bd4bc05b0d686a98d254f:/wp-admin/setup-config.php?ds=sidebyside diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index d8ae3560..34e19c76 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); @@ -26,44 +24,21 @@ 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); -/**#@+ - * 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); -/**#@-*/ - -require(ABSPATH . WPINC . '/load.php'); -require(ABSPATH . WPINC . '/version.php'); +define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); -// Check for the required PHP version and for the MySQL extension or a database drop-in. -wp_check_php_mysql_versions(); +require( ABSPATH . 'wp-settings.php' ); -require_once(ABSPATH . WPINC . '/functions.php'); +/** Load WordPress Administration Upgrade API */ +require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); -// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) -wp_load_translations_early(); +/** Load WordPress Translation Install API */ +require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); -// 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(); +nocache_headers(); // Support wp-config-sample.php one level up, for the develop repo. if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) @@ -81,38 +56,73 @@ if ( file_exists( ABSPATH . 'wp-config.php' ) ) if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) ) wp_die( '

' . sprintf( __( "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."), 'install.php' ) . '

' ); -$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; +$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1; /** * Display setup wp-config.php file header. * * @ignore * @since 2.3.0 - * @package WordPress - * @subpackage Installer_WP_Config */ -function setup_config_display_header() { +function setup_config_display_header( $body_classes = array() ) { global $wp_version; + $body_classes = (array) $body_classes; + $body_classes[] = 'wp-core-ui'; + if ( is_rtl() ) { + $body_classes[] = 'rtl'; + } header( 'Content-Type: text/html; charset=utf-8' ); ?> > - -<?php _e( 'WordPress › Setup Configuration File' ); ?> - - - + + + <?php _e( 'WordPress › Setup Configuration File' ); ?> + - -

+ +

'; + wp_install_language_form( $languages ); + echo ''; + break; + } + + // Deliberately fall through if we can't reach the translations API. + case 0: + if ( ! empty( $language ) ) { + $loaded_language = wp_download_language_pack( $language ); + if ( $loaded_language ) { + load_default_textdomain( $loaded_language ); + $GLOBALS['wp_locale'] = new WP_Locale(); + } + } + setup_config_display_header(); + $step_1 = 'setup-config.php?step=1'; + if ( isset( $_REQUEST['noapi'] ) ) { + $step_1 .= '&noapi'; + } + if ( ! empty( $loaded_language ) ) { + $step_1 .= '&language=' . $loaded_language; + } ?>

@@ -123,14 +133,21 @@ 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." ); ?> +

    -

    +

    @@ -148,7 +165,7 @@ switch($step) { - + @@ -163,16 +180,36 @@ switch($step) { +

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

    ' . __( 'Try again' ) . ''; if ( empty( $prefix ) ) wp_die( __( 'ERROR: "Table Prefix" must not be empty.' . $tryagain_link ) ); @@ -191,29 +228,27 @@ 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 ); } @@ -245,6 +280,11 @@ switch($step) { case 'DB_HOST' : $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; break; + case 'DB_CHARSET' : + if ( 'utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap( 'utf8mb4' ) ) ) { + $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'utf8mb4');\r\n"; + } + break; case 'AUTH_KEY' : case 'SECURE_AUTH_KEY' : case 'LOGGED_IN_KEY' : @@ -270,18 +310,22 @@ switch($step) { } ?>

    -

    +

    -

    +

    +