mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Themes: Clean up inactive themes' theme mods from being autoloaded as part of upcoming 6.5 upgrade routine.
Alongside [57153], this reduces unnecessarily autoloaded data from inactive themes, which can contribute to slow database performance as part of excessive autoloading. This changeset specifically resolves the issue for existing sites. Props mukesh27, joemcgill, swissspidy, westonruter, flixos90. Fixes #59975. See #39537. git-svn-id: https://develop.svn.wordpress.org/trunk@57155 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7ce1281349
commit
57a5164cbd
@ -843,6 +843,10 @@ function upgrade_all() {
|
||||
upgrade_640();
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 57155 ) {
|
||||
upgrade_650();
|
||||
}
|
||||
|
||||
maybe_disable_link_manager();
|
||||
|
||||
maybe_disable_automattic_widgets();
|
||||
@ -2349,6 +2353,35 @@ function upgrade_640() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes changes made in WordPress 6.5.0.
|
||||
*
|
||||
* @ignore
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @global int $wp_current_db_version The old (current) database version.
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*/
|
||||
function upgrade_650() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 57155 ) {
|
||||
$stylesheet = get_stylesheet();
|
||||
|
||||
// Set autoload=no for all themes except the current one.
|
||||
$theme_mods_options = $wpdb->get_col(
|
||||
$wpdb->prepare(
|
||||
"SELECT option_name FROM $wpdb->options WHERE autoload = 'yes' AND option_name != %s AND option_name LIKE %s",
|
||||
"theme_mods_$stylesheet",
|
||||
$wpdb->esc_like( 'theme_mods_' ) . '%'
|
||||
)
|
||||
);
|
||||
|
||||
$autoload = array_fill_keys( $theme_mods_options, 'no' );
|
||||
wp_set_option_autoload_values( $autoload );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes network-level upgrade routines.
|
||||
*
|
||||
|
||||
@ -23,7 +23,7 @@ $wp_version = '6.5-alpha-56966-src';
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 56657;
|
||||
$wp_db_version = 57155;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user