diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/includes/upgrade.php --- a/wp/wp-admin/includes/upgrade.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/includes/upgrade.php Fri Sep 05 18:40:08 2025 +0200 @@ -52,6 +52,21 @@ wp_check_mysql_version(); wp_cache_flush(); make_db_current_silent(); + + /* + * Ensure update checks are delayed after installation. + * + * This prevents users being presented with a maintenance mode screen + * immediately after installation. + */ + wp_unschedule_hook( 'wp_version_check' ); + wp_unschedule_hook( 'wp_update_plugins' ); + wp_unschedule_hook( 'wp_update_themes' ); + + wp_schedule_event( time() + HOUR_IN_SECONDS, 'twicedaily', 'wp_version_check' ); + wp_schedule_event( time() + ( 1.5 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_plugins' ); + wp_schedule_event( time() + ( 2 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_themes' ); + populate_options(); populate_roles(); @@ -147,7 +162,7 @@ * * @global wpdb $wpdb WordPress database abstraction object. * @global WP_Rewrite $wp_rewrite WordPress rewrite component. - * @global string $table_prefix + * @global string $table_prefix The database table prefix. * * @param int $user_id User ID. */ @@ -159,24 +174,7 @@ /* translators: Default category slug. */ $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); - if ( global_terms_enabled() ) { - $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); - if ( null == $cat_id ) { - $wpdb->insert( - $wpdb->sitecategories, - array( - 'cat_ID' => 0, - 'cat_name' => $cat_name, - 'category_nicename' => $cat_slug, - 'last_updated' => current_time( 'mysql', true ), - ) - ); - $cat_id = $wpdb->insert_id; - } - update_option( 'default_category', $cat_id ); - } else { - $cat_id = 1; - } + $cat_id = 1; $wpdb->insert( $wpdb->terms, @@ -368,7 +366,7 @@ $privacy_policy_content = get_site_option( 'default_privacy_policy_content' ); } else { if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) { - include_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; + require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php'; } $privacy_policy_content = WP_Privacy_Policy_Content::get_default_content(); @@ -457,8 +455,10 @@ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) ); - // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) - // TODO: Get previous_blog_id. + /* + * Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) + * TODO: Get previous_blog_id. + */ if ( ! is_super_admin( $user_id ) && 1 != $user_id ) { $wpdb->delete( $wpdb->usermeta, @@ -523,13 +523,13 @@ /* * Send a request to the site, and check whether - * the 'x-pingback' header is returned as expected. + * the 'X-Pingback' header is returned as expected. * * Uses wp_remote_get() instead of wp_remote_head() because web servers * can block head requests. */ $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); - $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' ); + $x_pingback_header = wp_remote_retrieve_header( $response, 'X-Pingback' ); $pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header; if ( $pretty_permalinks ) { @@ -640,10 +640,9 @@ * * @global int $wp_current_db_version The old (current) database version. * @global int $wp_db_version The new database version. - * @global wpdb $wpdb WordPress database abstraction object. */ function wp_upgrade() { - global $wp_current_db_version, $wp_db_version, $wpdb; + global $wp_current_db_version, $wp_db_version; $wp_current_db_version = __get_option( 'db_version' ); @@ -671,6 +670,8 @@ update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() ); } + delete_transient( 'wp_core_block_css_files' ); + /** * Fires after a site is fully upgraded. * @@ -849,6 +850,18 @@ upgrade_600(); } + if ( $wp_current_db_version < 55853 ) { + upgrade_630(); + } + + if ( $wp_current_db_version < 56657 ) { + upgrade_640(); + } + + if ( $wp_current_db_version < 57155 ) { + upgrade_650(); + } + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -1005,7 +1018,6 @@ $wpdb->query( "UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); $wpdb->query( "UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" ); } - } /** @@ -1303,7 +1315,7 @@ $num = 2; do { $alt_slug = $slug . "-$num"; - $num++; + ++$num; $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) ); } while ( $slug_check ); @@ -1555,7 +1567,6 @@ if ( $wp_current_db_version < 6689 ) { populate_roles_250(); } - } /** @@ -1655,8 +1666,10 @@ global $wp_current_db_version; if ( $wp_current_db_version < 11958 ) { - // Previously, setting depth to 1 would redundantly disable threading, - // but now 2 is the minimum depth to avoid confusion. + /* + * Previously, setting depth to 1 would redundantly disable threading, + * but now 2 is the minimum depth to avoid confusion. + */ if ( get_option( 'thread_comments_depth' ) == '1' ) { update_option( 'thread_comments_depth', 2 ); update_option( 'thread_comments', 0 ); @@ -1712,7 +1725,6 @@ ) ); } - } /** @@ -1756,6 +1768,7 @@ $_sidebars_widgets[ $index ][ $i ] = $id; continue; } + $id = sanitize_title( $name ); if ( isset( $wp_registered_widgets[ $id ] ) ) { $_sidebars_widgets[ $index ][ $i ] = $id; @@ -1765,13 +1778,15 @@ $found = false; foreach ( $wp_registered_widgets as $widget_id => $widget ) { - if ( strtolower( $widget['name'] ) == strtolower( $name ) ) { + if ( strtolower( $widget['name'] ) === strtolower( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; - $found = true; + + $found = true; break; - } elseif ( sanitize_title( $widget['name'] ) == sanitize_title( $name ) ) { + } elseif ( sanitize_title( $widget['name'] ) === sanitize_title( $name ) ) { $_sidebars_widgets[ $index ][ $i ] = $widget['id']; - $found = true; + + $found = true; break; } } @@ -1852,7 +1867,7 @@ if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) { $meta_keys = array(); foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) { - if ( false !== strpos( $name, '-' ) ) { + if ( str_contains( $name, '-' ) ) { $meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page'; } } @@ -2177,6 +2192,8 @@ * * @ignore * @since 5.5.0 + * + * @global int $wp_current_db_version The old (current) database version. */ function upgrade_550() { global $wp_current_db_version; @@ -2215,6 +2232,9 @@ * * @ignore * @since 5.6.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. */ function upgrade_560() { global $wp_current_db_version, $wpdb; @@ -2303,6 +2323,81 @@ } /** + * Executes changes made in WordPress 6.3.0. + * + * @ignore + * @since 6.3.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ +function upgrade_630() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 55853 ) { + if ( ! is_multisite() ) { + // Replace non-autoload option can_compress_scripts with autoload option, see #55270 + $can_compress_scripts = get_option( 'can_compress_scripts', false ); + if ( false !== $can_compress_scripts ) { + delete_option( 'can_compress_scripts' ); + add_option( 'can_compress_scripts', $can_compress_scripts, '', 'yes' ); + } + } + } +} + +/** + * Executes changes made in WordPress 6.4.0. + * + * @ignore + * @since 6.4.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ +function upgrade_640() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 56657 ) { + // Enable attachment pages. + update_option( 'wp_attachment_pages_enabled', 1 ); + + // Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check. + $scheduled = wp_get_scheduled_event( 'wp_https_detection' ); + if ( $scheduled ) { + wp_clear_scheduled_hook( 'wp_https_detection' ); + } + } +} + +/** + * 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 @@ -2461,7 +2556,7 @@ /** * Creates a table in the database, if it doesn't already exist. * - * This method checks for an existing database and creates a new one if it's not + * This method checks for an existing database table and creates a new one if it's not * already present. It doesn't rely on MySQL's "IF NOT EXISTS" statement, but chooses * to query all tables first and then run the SQL statement creating the table. * @@ -2629,7 +2724,7 @@ */ function get_alloptions_110() { global $wpdb; - $all_options = new stdClass; + $all_options = new stdClass(); $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); if ( $options ) { foreach ( $options as $option ) { @@ -2713,6 +2808,8 @@ * Useful for creating new tables and updating existing tables to a new structure. * * @since 1.5.0 + * @since 6.1.0 Ignores display width for integer data types on MySQL 8.0.17 or later, + * to match MySQL behavior. Note: This does not affect MariaDB. * * @global wpdb $wpdb WordPress database abstraction object. * @@ -2749,19 +2846,27 @@ $iqueries = array(); // Insertion queries. $for_update = array(); - // Create a tablename index for an array ($cqueries) of queries. + // Create a tablename index for an array ($cqueries) of recognized query types. foreach ( $queries as $qry ) { if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { $cqueries[ trim( $matches[1], '`' ) ] = $qry; $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; - } elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { + continue; + } + + if ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) { array_unshift( $cqueries, $qry ); - } elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { + continue; + } + + if ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; - } elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { + continue; + } + + if ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) { $iqueries[] = $qry; - } else { - // Unrecognized query type. + continue; } } @@ -2789,8 +2894,12 @@ $text_fields = array( 'tinytext', 'text', 'mediumtext', 'longtext' ); $blob_fields = array( 'tinyblob', 'blob', 'mediumblob', 'longblob' ); - - $global_tables = $wpdb->tables( 'global' ); + $int_fields = array( 'tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint' ); + + $global_tables = $wpdb->tables( 'global' ); + $db_version = $wpdb->db_version(); + $db_server_info = $wpdb->db_server_info(); + foreach ( $cqueries as $table => $qry ) { // Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal. if ( in_array( $table, $global_tables, true ) && ! wp_should_upgrade_global_tables() ) { @@ -2849,31 +2958,29 @@ */ // Extract type, name and columns from the definition. - // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation preg_match( - '/^' - . '(?P' // 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' // 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' - . '.+?' // 3) Column names, index prefixes, and orders. - . ')' - . '\)' // Closing bracket for the columns. - . '$/im', + '/^ + (?P # 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 # 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 + .+? # 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'] ) ) ); @@ -2892,23 +2999,23 @@ foreach ( $index_columns as $id => &$index_column ) { // Extract column name and number of indexed characters (sub_part). preg_match( - '/' - . '`?' // Name can be escaped with a backtick. - . '(?P' // 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' - . '\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 # 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 + \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 ); @@ -2946,6 +3053,19 @@ $tablefield_field_lowercased = strtolower( $tablefield->Field ); $tablefield_type_lowercased = strtolower( $tablefield->Type ); + $tablefield_type_without_parentheses = preg_replace( + '/' + . '(.+)' // Field type, e.g. `int`. + . '\(\d*\)' // Display width. + . '(.*)' // Optional attributes, e.g. `unsigned`. + . '/', + '$1$2', + $tablefield_type_lowercased + ); + + // Get the type without attributes, e.g. `int`. + $tablefield_type_base = strtok( $tablefield_type_without_parentheses, ' ' ); + // If the table field exists in the field array... if ( array_key_exists( $tablefield_field_lowercased, $cfields ) ) { @@ -2954,6 +3074,19 @@ $fieldtype = $matches[1]; $fieldtype_lowercased = strtolower( $fieldtype ); + $fieldtype_without_parentheses = preg_replace( + '/' + . '(.+)' // Field type, e.g. `int`. + . '\(\d*\)' // Display width. + . '(.*)' // Optional attributes, e.g. `unsigned`. + . '/', + '$1$2', + $fieldtype_lowercased + ); + + // Get the type without attributes, e.g. `int`. + $fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' ); + // Is actual field type different from the field type in query? if ( $tablefield->Type != $fieldtype ) { $do_change = true; @@ -2969,6 +3102,21 @@ } } + if ( in_array( $fieldtype_base, $int_fields, true ) && in_array( $tablefield_type_base, $int_fields, true ) + && $fieldtype_without_parentheses === $tablefield_type_without_parentheses + ) { + /* + * MySQL 8.0.17 or later does not support display width for integer data types, + * so if display width is the only difference, it can be safely ignored. + * Note: This is specific to MySQL and does not affect MariaDB. + */ + if ( version_compare( $db_version, '8.0.17', '>=' ) + && ! str_contains( $db_server_info, 'MariaDB' ) + ) { + $do_change = false; + } + } + if ( $do_change ) { // Add a query to change the column type. $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN `{$tablefield->Field}` " . $cfields[ $tablefield_field_lowercased ]; @@ -3033,16 +3181,20 @@ } elseif ( $index_data['unique'] ) { $index_string .= 'UNIQUE '; } + if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'FULLTEXT '; } + if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) { $index_string .= 'SPATIAL '; } + $index_string .= 'KEY '; if ( 'primary' !== $index_name ) { $index_string .= '`' . $index_name . '`'; } + $index_columns = ''; // For each column in the index. @@ -3139,8 +3291,9 @@ * @return bool */ function make_site_theme_from_oldschool( $theme_name, $template ) { - $home_path = get_home_path(); - $site_dir = WP_CONTENT_DIR . "/themes/$template"; + $home_path = get_home_path(); + $site_dir = WP_CONTENT_DIR . "/themes/$template"; + $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; if ( ! file_exists( "$home_path/index.php" ) ) { return false; @@ -3167,8 +3320,8 @@ // Check to make sure it's not a new index. if ( 'index.php' === $oldfile ) { $index = implode( '', file( "$oldpath/$oldfile" ) ); - if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) { - if ( ! copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) { + if ( str_contains( $index, 'WP_USE_THEMES' ) ) { + if ( ! copy( "$default_dir/$oldfile", "$site_dir/$newfile" ) ) { return false; } @@ -3194,10 +3347,18 @@ } // Update stylesheet references. - $line = str_replace( "/wp-layout.css", "", $line ); + $line = str_replace( + "/wp-layout.css", + "", + $line + ); // Update comments template inclusion. - $line = str_replace( "", '', $line ); + $line = str_replace( + "", + '', + $line + ); fwrite( $f, "{$line}\n" ); } @@ -3206,7 +3367,13 @@ } // Add a theme header. - $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option( 'siteurl' ) . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n"; + $header = "/*\n" . + "Theme Name: $theme_name\n" . + 'Theme URI: ' . __get_option( 'siteurl' ) . "\n" . + "Description: A theme automatically created by the update.\n" . + "Version: 1.0\n" . + "Author: Moi\n" . + "*/\n"; $stylelines = file_get_contents( "$site_dir/style.css" ); if ( $stylelines ) { @@ -3235,8 +3402,10 @@ $site_dir = WP_CONTENT_DIR . "/themes/$template"; $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME; - // Copy files from the default theme to the site theme. - // $files = array( 'index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css' ); + /* + * Copy files from the default theme to the site theme. + * $files = array( 'index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css' ); + */ $theme_dir = @opendir( $default_dir ); if ( $theme_dir ) { @@ -3244,9 +3413,11 @@ if ( is_dir( "$default_dir/$theme_file" ) ) { continue; } + if ( ! copy( "$default_dir/$theme_file", "$site_dir/$theme_file" ) ) { return; } + chmod( "$site_dir/$theme_file", 0777 ); } @@ -3258,20 +3429,25 @@ if ( $stylelines ) { $f = fopen( "$site_dir/style.css", 'w' ); + $headers = array( + 'Theme Name:' => $theme_name, + 'Theme URI:' => __get_option( 'url' ), + 'Description:' => 'Your theme.', + 'Version:' => '1', + 'Author:' => 'You', + ); + foreach ( $stylelines as $line ) { - if ( strpos( $line, 'Theme Name:' ) !== false ) { - $line = 'Theme Name: ' . $theme_name; - } elseif ( strpos( $line, 'Theme URI:' ) !== false ) { - $line = 'Theme URI: ' . __get_option( 'url' ); - } elseif ( strpos( $line, 'Description:' ) !== false ) { - $line = 'Description: Your theme.'; - } elseif ( strpos( $line, 'Version:' ) !== false ) { - $line = 'Version: 1'; - } elseif ( strpos( $line, 'Author:' ) !== false ) { - $line = 'Author: You'; + foreach ( $headers as $header => $value ) { + if ( str_contains( $line, $header ) ) { + $line = $header . ' ' . $value; + break; + } } + fwrite( $f, $line . "\n" ); } + fclose( $f ); } @@ -3287,9 +3463,11 @@ if ( is_dir( "$default_dir/images/$image" ) ) { continue; } + if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) { return; } + chmod( "$site_dir/images/$image", 0777 ); } @@ -3488,33 +3666,6 @@ } } -if ( ! function_exists( 'install_global_terms' ) ) : - /** - * Install global terms. - * - * @since 3.0.0 - * - * @global wpdb $wpdb WordPress database abstraction object. - * @global string $charset_collate - */ - function install_global_terms() { - global $wpdb, $charset_collate; - $ms_queries = " -CREATE TABLE $wpdb->sitecategories ( - cat_ID bigint(20) NOT NULL auto_increment, - cat_name varchar(55) NOT NULL default '', - category_nicename varchar(200) NOT NULL default '', - last_updated timestamp NOT NULL, - PRIMARY KEY (cat_ID), - KEY category_nicename (category_nicename), - KEY last_updated (last_updated) -) $charset_collate; -"; - // Now create tables. - dbDelta( $ms_queries ); - } -endif; - /** * Determine if global tables should be upgraded. *