X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/596d585e1dc1eb25bccd3781e37210a4e2504179..38ac4bc40322ecdc4052db4263466573e01fa51f:/wp-admin/setup-config.php diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 5bf19ad1..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,47 +24,30 @@ 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(); +nocache_headers(); -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(); - -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' ) . '

' ); @@ -75,37 +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 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' ); ?> + -> -

WordPress

+ +

'; + wp_install_language_form( $languages ); + echo ''; + break; + } + + // Deliberately fall through if we can't reach the translations API. + case 0: - display_header(); + 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; + } ?>

@@ -116,18 +133,25 @@ 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." ); ?> +

    -

    +

    -

    +

    @@ -141,7 +165,7 @@ switch($step) { - + @@ -156,16 +180,36 @@ switch($step) {
    -

    + +

    ' . __( 'Try Again' ) . ''; + if ( ! empty( $language ) ) { + $step_1 .= '&language=' . $language; + $install .= '?language=' . $language; + } else { + $install .= '?language=en_US'; + } + + $tryagain_link = '

    ' . __( 'Try again' ) . ''; if ( empty( $prefix ) ) wp_die( __( 'ERROR: "Table Prefix" must not be empty.' . $tryagain_link ) ); @@ -184,30 +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' ); - 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', '' ) ); - } - /**#@-*/ $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 ); } @@ -239,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' : @@ -254,34 +300,53 @@ switch($step) { 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.' ); ?>

    - -

    -

    +

    +

    + -

    +

    -

    +

    +