WordPress.org

Make WordPress Core

Changeset 52602


Ignore:
Timestamp:
01/18/2022 11:45:40 PM (5 hours ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r52547 r52602  
    310310                sprintf(
    311311                    'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
    312                     ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
     312                    wp_installing() ? '' : wp_create_nonce( 'wp_rest' )
    313313                ),
    314314                'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );',
     
    712712        array(
    713713            'root'          => esc_url_raw( get_rest_url() ),
    714             'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
     714            'nonce'         => wp_installing() ? '' : wp_create_nonce( 'wp_rest' ),
    715715            'versionString' => 'wp/v2/',
    716716        )
     
    11101110        array(
    11111111            'user_id' => $user_id,
    1112             'nonce'   => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ),
     1112            'nonce'   => wp_installing() ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ),
    11131113        )
    11141114    );
     
    13361336            '_wpUpdatesSettings',
    13371337            array(
    1338                 'ajax_nonce' => wp_create_nonce( 'updates' ),
     1338                'ajax_nonce' => wp_installing() ? '' : wp_create_nonce( 'updates' ),
    13391339            )
    13401340        );
Note: See TracChangeset for help on using the changeset viewer.