--- a/wp/wp-admin/install.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/install.php Tue Dec 15 13:49:49 2020 +0100
@@ -10,7 +10,7 @@
if ( false ) {
?>
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Error: PHP is not running</title>
@@ -33,16 +33,16 @@
define( 'WP_INSTALLING', true );
/** Load WordPress Bootstrap */
-require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+require_once dirname( __DIR__ ) . '/wp-load.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 Install API */
-require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+require_once ABSPATH . 'wp-admin/includes/translation-install.php';
/** Load wpdb */
-require_once( ABSPATH . WPINC . '/wp-db.php' );
+require_once ABSPATH . WPINC . '/wp-db.php';
nocache_headers();
@@ -65,7 +65,7 @@
}
?>
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -74,10 +74,10 @@
<?php wp_admin_css( 'install', true ); ?>
</head>
<body class="wp-core-ui<?php echo $body_classes; ?>">
-<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p>
+<p id="logo"><?php _e( 'WordPress' ); ?></p>
<?php
-} // end display_header()
+} // End display_header().
/**
* Display installer setup form.
@@ -91,10 +91,9 @@
function display_setup_form( $error = null ) {
global $wpdb;
- $sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) );
- $user_table = ( $wpdb->get_var( $sql ) != null );
+ $user_table = ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ) ) !== null );
- // Ensure that Blogs appear in search engines by default.
+ // Ensure that sites appear in search engines by default.
$blog_public = 1;
if ( isset( $_POST['weblog_title'] ) ) {
$blog_public = isset( $_POST['blog_public'] );
@@ -180,10 +179,10 @@
<p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
</tr>
<tr>
- <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th>
+ <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?></th>
<td>
<fieldset>
- <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
+ <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?> </span></legend>
<?php
if ( has_action( 'blog_privacy_selector' ) ) {
?>
@@ -209,7 +208,7 @@
<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
</form>
<?php
-} // end display_setup_form()
+} // End display_setup_form().
// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) {
@@ -223,9 +222,9 @@
}
/**
- * @global string $wp_version
- * @global string $required_php_version
- * @global string $required_mysql_version
+ * @global string $wp_version The WordPress version string.
+ * @global string $required_php_version The required PHP version string.
+ * @global string $required_mysql_version The required MySQL version string.
*/
global $wp_version, $required_php_version, $required_mysql_version;
@@ -235,33 +234,57 @@
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
$version_url = sprintf(
- /* translators: %s: WordPress version */
+ /* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( $wp_version )
);
-/* translators: %s: Update PHP page URL */
-$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) );
+/* translators: %s: URL to Update PHP page. */
+$php_update_message = '</p><p>' . sprintf(
+ __( '<a href="%s">Learn more about updating PHP</a>.' ),
+ esc_url( wp_get_update_php_url() )
+);
$annotation = wp_get_update_php_annotation();
+
if ( $annotation ) {
$php_update_message .= '</p><p><em>' . $annotation . '</em>';
}
if ( ! $mysql_compat && ! $php_compat ) {
- /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */
- $compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) . $php_update_message;
+ $compat = sprintf(
+ /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */
+ __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ),
+ $version_url,
+ $wp_version,
+ $required_php_version,
+ $required_mysql_version,
+ $php_version,
+ $mysql_version
+ ) . $php_update_message;
} elseif ( ! $php_compat ) {
- /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */
- $compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_php_version, $php_version ) . $php_update_message;
+ $compat = sprintf(
+ /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */
+ __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ),
+ $version_url,
+ $wp_version,
+ $required_php_version,
+ $php_version
+ ) . $php_update_message;
} elseif ( ! $mysql_compat ) {
- /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */
- $compat = sprintf( __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $wp_version, $required_mysql_version, $mysql_version );
+ $compat = sprintf(
+ /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */
+ __( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ),
+ $version_url,
+ $wp_version,
+ $required_mysql_version,
+ $mysql_version
+ );
}
if ( ! $mysql_compat || ! $php_compat ) {
display_header();
- die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' );
+ die( '<h1>' . __( 'Requirements Not Met' ) . '</h1><p>' . $compat . '</p></body></html>' );
}
if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
@@ -290,8 +313,8 @@
}
/**
- * @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.
*/
$language = '';
if ( ! empty( $_REQUEST['language'] ) ) {
@@ -303,14 +326,17 @@
$scripts_to_print = array( 'jquery' );
switch ( $step ) {
- case 0: // Step 0
- if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
- $scripts_to_print[] = 'language-chooser';
- display_header( 'language-chooser' );
- echo '<form id="setup" method="post" action="?step=1">';
- wp_install_language_form( $languages );
- echo '</form>';
- break;
+ case 0: // Step 0.
+ if ( wp_can_install_language_pack() && empty( $language ) ) {
+ $languages = wp_get_available_translations();
+ if ( $languages ) {
+ $scripts_to_print[] = 'language-chooser';
+ display_header( 'language-chooser' );
+ echo '<form id="setup" method="post" action="?step=1">';
+ wp_install_language_form( $languages );
+ echo '</form>';
+ break;
+ }
}
// Deliberately fall through if we can't reach the translations API.
@@ -352,7 +378,7 @@
$scripts_to_print[] = 'user-profile';
display_header();
- // Fill in the data we gathered
+ // Fill in the data we gathered.
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
$admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : '';
@@ -363,27 +389,27 @@
// Check email address.
$error = false;
if ( empty( $user_name ) ) {
- // TODO: poka-yoke
+ // TODO: Poka-yoke.
display_setup_form( __( 'Please provide a valid username.' ) );
$error = true;
- } elseif ( $user_name != sanitize_user( $user_name, true ) ) {
+ } elseif ( sanitize_user( $user_name, true ) !== $user_name ) {
display_setup_form( __( 'The username you provided has invalid characters.' ) );
$error = true;
- } elseif ( $admin_password != $admin_password_check ) {
- // TODO: poka-yoke
+ } elseif ( $admin_password !== $admin_password_check ) {
+ // TODO: Poka-yoke.
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
$error = true;
} elseif ( empty( $admin_email ) ) {
- // TODO: poka-yoke
+ // TODO: Poka-yoke.
display_setup_form( __( 'You must provide an email address.' ) );
$error = true;
} elseif ( ! is_email( $admin_email ) ) {
- // TODO: poka-yoke
+ // TODO: Poka-yoke.
display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
$error = true;
}
- if ( $error === false ) {
+ if ( false === $error ) {
$wpdb->show_errors();
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
?>