diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/setup-config.php --- a/wp/wp-admin/setup-config.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/setup-config.php Tue Dec 15 13:49:49 2020 +0100 @@ -27,16 +27,16 @@ error_reporting( 0 ); if ( ! defined( 'ABSPATH' ) ) { - define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' ); + define( 'ABSPATH', dirname( __DIR__ ) . '/' ); } -require( ABSPATH . 'wp-settings.php' ); +require ABSPATH . 'wp-settings.php'; /** Load WordPress Administration Upgrade API */ -require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); +require_once ABSPATH . 'wp-admin/includes/upgrade.php'; /** Load WordPress Translation Installation API */ -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); +require_once ABSPATH . 'wp-admin/includes/translation-install.php'; nocache_headers(); @@ -55,7 +55,7 @@ ); } -// Check if wp-config.php has been created +// Check if wp-config.php has been created. if ( file_exists( ABSPATH . 'wp-config.php' ) ) { wp_die( '

' . sprintf( @@ -63,11 +63,12 @@ __( 'The file %1$s already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try installing now.' ), 'wp-config.php', 'install.php' - ) . '

' + ) . '

', + 409 ); } -// Check if wp-config.php exists above the root directory but is not part of another installation +// Check if wp-config.php exists above the root directory but is not part of another installation. if ( @file_exists( ABSPATH . '../wp-config.php' ) && ! @file_exists( ABSPATH . '../wp-settings.php' ) ) { wp_die( '

' . sprintf( @@ -75,7 +76,8 @@ __( 'The file %1$s 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.' ), 'wp-config.php', 'install.php' - ) . '

' + ) . '

', + 409 ); } @@ -87,8 +89,8 @@ * @ignore * @since 2.3.0 * - * @global string $wp_local_package - * @global WP_Locale $wp_locale + * @global string $wp_local_package Locale code of the package. + * @global WP_Locale $wp_locale WordPress date and time locale object. * * @param string|array $body_classes */ @@ -104,7 +106,7 @@ header( 'Content-Type: text/html; charset=utf-8' ); ?> -> +> @@ -113,9 +115,9 @@ - + Select a default language'; - echo '
'; - wp_install_language_form( $languages ); - echo '
'; - break; + if ( wp_can_install_language_pack() && empty( $language ) ) { + $languages = wp_get_available_translations(); + if ( $languages ) { + setup_config_display_header( 'language-chooser' ); + echo '

Select a default language

'; + echo '
'; + wp_install_language_form( $languages ); + echo '
'; + break; + } } // Deliberately fall through if we can't reach the translations API. @@ -166,16 +171,16 @@

wp-config.php' ); ?> wp-config-sample.php', 'wp-config.php' @@ -183,10 +188,10 @@ ?> We got it.' ), - __( 'https://codex.wordpress.org/Editing_wp-config.php' ) + __( 'https://wordpress.org/support/article/editing-wp-config-php/' ) ); ?>

@@ -272,18 +277,18 @@ $install .= '?language=en_US'; } - $tryagain_link = '

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

' . __( 'Try Again' ) . ''; if ( empty( $prefix ) ) { - wp_die( __( 'ERROR: "Table Prefix" must not be empty.' ) . $tryagain_link ); + wp_die( __( 'Error: "Table Prefix" must not be empty.' ) . $tryagain_link ); } // Validate $prefix: it can only contain letters, numbers and underscores. if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) { - wp_die( __( 'ERROR: "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link ); + wp_die( __( 'Error: "Table Prefix" can only contain numbers, letters, and underscores.' ) . $tryagain_link ); } - // Test the db connection. + // Test the DB connection. /**#@+ * * @ignore @@ -313,7 +318,7 @@ $wpdb->show_errors( $errors ); if ( ! $wpdb->last_error ) { // MySQL was able to parse the prefix as a value, which we don't want. Bail. - wp_die( __( 'ERROR: "Table Prefix" is invalid.' ) ); + wp_die( __( 'Error: "Table Prefix" is invalid.' ) ); } // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password(). @@ -349,7 +354,7 @@ $key = 0; foreach ( $config_file as $line_num => $line ) { - if ( '$table_prefix =' == substr( $line, 0, 15 ) ) { + if ( '$table_prefix =' === substr( $line, 0, 15 ) ) { $config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; continue; } @@ -393,7 +398,7 @@

wp-config.php' ); + printf( __( 'Unable to write to %s file.' ), 'wp-config.php' ); ?>

@@ -409,7 +414,7 @@ ?>

-

+