From f7151a6f3a8bb8aaf317d7be73eb178b7d7cb88d Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 18 Jan 2022 23:47:01 +0000 Subject: [PATCH] Script loader: Prevent DB errors during Multisite install. Prevent the script loader from attempting to create nonces during the installation process for Multisite configurations. Prior to this fix, multiple "Table does not exist" errors were thrown during installation if `MULTISITE` was defined in the `wp-config.php` file but the salt constants were not defined. Without the salts defined in PHP, WP was attempting to use the database fallbacks prior to table creation. Props schlessera, johnbillion, hellofromTonya, audrasjb, costdev. Fixes #54800. Built from https://develop.svn.wordpress.org/trunk@52602 git-svn-id: http://core.svn.wordpress.org/trunk@52190 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 8 ++++---- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 5964c92074..173022237c 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -309,7 +309,7 @@ function wp_default_packages_inline_scripts( $scripts ) { array( sprintf( 'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );', - ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ) + wp_installing() ? '' : wp_create_nonce( 'wp_rest' ) ), 'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );', 'wp.apiFetch.use( wp.apiFetch.mediaUploadMiddleware );', @@ -711,7 +711,7 @@ function wp_default_scripts( $scripts ) { 'wpApiSettings', array( 'root' => esc_url_raw( get_rest_url() ), - 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ), + 'nonce' => wp_installing() ? '' : wp_create_nonce( 'wp_rest' ), 'versionString' => 'wp/v2/', ) ); @@ -1109,7 +1109,7 @@ function wp_default_scripts( $scripts ) { 'userProfileL10n', array( 'user_id' => $user_id, - 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ), + 'nonce' => wp_installing() ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ), ) ); @@ -1335,7 +1335,7 @@ function wp_default_scripts( $scripts ) { 'updates', '_wpUpdatesSettings', array( - 'ajax_nonce' => wp_create_nonce( 'updates' ), + 'ajax_nonce' => wp_installing() ? '' : wp_create_nonce( 'updates' ), ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index f323bc5d4e..486642abf0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52598'; +$wp_version = '6.0-alpha-52602'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.