diff options
Diffstat (limited to 'wp-admin/includes/upgrade.php')
-rw-r--r-- | wp-admin/includes/upgrade.php | 109 |
1 files changed, 69 insertions, 40 deletions
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 6929570..cb39391 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -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(); @@ -2350,6 +2354,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. * * @since 3.0.0 @@ -2910,31 +2943,29 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N */ // Extract type, name and columns from the definition. - // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation preg_match( - '/^' - . '(?P<index_type>' // 1) Type of the index. - . 'PRIMARY\s+KEY|(?:UNIQUE|FULLTEXT|SPATIAL)\s+(?:KEY|INDEX)|KEY|INDEX' - . ')' - . '\s+' // Followed by at least one white space character. - . '(?:' // Name of the index. Optional if type is PRIMARY KEY. - . '`?' // Name can be escaped with a backtick. - . '(?P<index_name>' // 2) Name of the index. - . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' - . ')' - . '`?' // Name can be escaped with a backtick. - . '\s+' // Followed by at least one white space character. - . ')*' - . '\(' // Opening bracket for the columns. - . '(?P<index_columns>' - . '.+?' // 3) Column names, index prefixes, and orders. - . ')' - . '\)' // Closing bracket for the columns. - . '$/im', + '/^ + (?P<index_type> # 1) Type of the index. + PRIMARY\s+KEY|(?:UNIQUE|FULLTEXT|SPATIAL)\s+(?:KEY|INDEX)|KEY|INDEX + ) + \s+ # Followed by at least one white space character. + (?: # Name of the index. Optional if type is PRIMARY KEY. + `? # Name can be escaped with a backtick. + (?P<index_name> # 2) Name of the index. + (?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+ + ) + `? # Name can be escaped with a backtick. + \s+ # Followed by at least one white space character. + )* + \( # Opening bracket for the columns. + (?P<index_columns> + .+? # 3) Column names, index prefixes, and orders. + ) + \) # Closing bracket for the columns. + $/imx', $fld, $index_matches ); - // phpcs:enable // Uppercase the index type and normalize space characters. $index_type = strtoupper( preg_replace( '/\s+/', ' ', trim( $index_matches['index_type'] ) ) ); @@ -2952,29 +2983,27 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // Normalize columns. foreach ( $index_columns as $id => &$index_column ) { // Extract column name and number of indexed characters (sub_part). - // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation preg_match( - '/' - . '`?' // Name can be escaped with a backtick. - . '(?P<column_name>' // 1) Name of the column. - . '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+' - . ')' - . '`?' // Name can be escaped with a backtick. - . '(?:' // Optional sub part. - . '\s*' // Optional white space character between name and opening bracket. - . '\(' // Opening bracket for the sub part. - . '\s*' // Optional white space character after opening bracket. - . '(?P<sub_part>' - . '\d+' // 2) Number of indexed characters. - . ')' - . '\s*' // Optional white space character before closing bracket. - . '\)' // Closing bracket for the sub part. - . ')?' - . '/', + '/ + `? # Name can be escaped with a backtick. + (?P<column_name> # 1) Name of the column. + (?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+ + ) + `? # Name can be escaped with a backtick. + (?: # Optional sub part. + \s* # Optional white space character between name and opening bracket. + \( # Opening bracket for the sub part. + \s* # Optional white space character after opening bracket. + (?P<sub_part> + \d+ # 2) Number of indexed characters. + ) + \s* # Optional white space character before closing bracket. + \) # Closing bracket for the sub part. + )? + /x', $index_column, $index_column_matches ); - // phpcs:enable // Escape the column name with backticks. $index_column = '`' . $index_column_matches['column_name'] . '`'; |