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
This commit is contained in:
Peter Wilson 2022-01-18 23:47:01 +00:00
parent 1543616cff
commit f7151a6f3a
2 changed files with 5 additions and 5 deletions

View File

@ -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' ),
)
);

View File

@ -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.