Make WordPress Core


Ignore:
Timestamp:
05/24/2023 05:33:26 PM (19 months ago)
Author:
spacedmonkey
Message:

Options, Meta APIs: Change the option can_compress_scripts to be autoloaded.

Ensure that the option can_compress_scripts is autoloaded on single sites, as this option is used in all requests. This change saves one database query per page request.

Props RavanH, spacedmonkey, costdev, azaozz, flixos90.
Fixes #55270.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r55698 r55854  
    833833    }
    834834
     835    if ( $wp_current_db_version < 55853 ) {
     836        upgrade_630();
     837    }
     838
    835839    maybe_disable_link_manager();
    836840
     
    22952299
    22962300/**
     2301 * Executes changes made in WordPress 6.3.0.
     2302 *
     2303 * @ignore
     2304 * @since 6.3.0
     2305 *
     2306 * @global int $wp_current_db_version The old (current) database version.
     2307 */
     2308function upgrade_630() {
     2309    global $wp_current_db_version;
     2310
     2311    if ( $wp_current_db_version < 55853 ) {
     2312        if ( ! is_multisite() ) {
     2313            // Replace non-autoload option can_compress_scripts with autoload option, see #55270
     2314            $can_compress_scripts = get_option( 'can_compress_scripts', false );
     2315            if ( false !== $can_compress_scripts ) {
     2316                delete_option( 'can_compress_scripts' );
     2317                add_option( 'can_compress_scripts', $can_compress_scripts, 'yes' );
     2318            }
     2319        }
     2320    }
     2321}
     2322
     2323/**
    22972324 * Executes network-level upgrade routines.
    22982325 *
Note: See TracChangeset for help on using the changeset viewer.