WordPress.org

Make WordPress Core

Ticket #31245: 31245.4.fabian-race-fix.diff

File 31245.4.fabian-race-fix.diff, 1.2 KB (added by SergeyBiryukov, 7 months ago)
  • src/wp-includes/option.php

     
    189189 * Loads and caches all autoloaded options, if available or all options.
    190190 *
    191191 * @since 2.2.0
     192 * @since 5.4.0 The `$force_cache` parameter was added.
    192193 *
    193194 * @global wpdb $wpdb WordPress database abstraction object.
    194195 *
     196 * @param bool $force_cache Optional. Whether to force an update of the local cache
     197 *                          from the persistent cache. Default false.
    195198 * @return array List of all options.
    196199 */
    197 function wp_load_alloptions() {
     200function wp_load_alloptions( $force_cache = false ) {
    198201        global $wpdb;
    199202
    200203        if ( ! wp_installing() || ! is_multisite() ) {
    201                 $alloptions = wp_cache_get( 'alloptions', 'options' );
     204                $alloptions = wp_cache_get( 'alloptions', 'options', $force_cache );
    202205        } else {
    203206                $alloptions = false;
    204207        }
     
    397400        }
    398401
    399402        if ( ! wp_installing() ) {
    400                 $alloptions = wp_load_alloptions();
     403                $alloptions = wp_load_alloptions( true );
    401404                if ( isset( $alloptions[ $option ] ) ) {
    402405                        $alloptions[ $option ] = $serialized_value;
    403406                        wp_cache_set( 'alloptions', $alloptions, 'options' );