X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..8ab4a4532479e8db471032b51042ec8c4716d091:/wp-admin/includes/schema.php diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 296a6992..c522ab56 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -44,6 +44,13 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) { // Engage multisite if in the middle of turning it on from network.php. $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); + /* + * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. + * As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which + * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters. + */ + $max_index_length = 191; + // Blog specific tables. $blog_tables = "CREATE TABLE $wpdb->terms ( term_id bigint(20) unsigned NOT NULL auto_increment, @@ -51,8 +58,8 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) { slug varchar(200) NOT NULL default '', term_group bigint(10) NOT NULL default 0, PRIMARY KEY (term_id), - KEY slug (slug), - KEY name (name) + KEY slug (slug($max_index_length)), + KEY name (name($max_index_length)) ) $charset_collate; CREATE TABLE $wpdb->term_taxonomy ( term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, @@ -79,7 +86,7 @@ CREATE TABLE $wpdb->commentmeta ( meta_value longtext, PRIMARY KEY (meta_id), KEY comment_id (comment_id), - KEY meta_key (meta_key) + KEY meta_key (meta_key($max_index_length)) ) $charset_collate; CREATE TABLE $wpdb->comments ( comment_ID bigint(20) unsigned NOT NULL auto_increment, @@ -136,7 +143,7 @@ CREATE TABLE $wpdb->postmeta ( meta_value longtext, PRIMARY KEY (meta_id), KEY post_id (post_id), - KEY meta_key (meta_key) + KEY meta_key (meta_key($max_index_length)) ) $charset_collate; CREATE TABLE $wpdb->posts ( ID bigint(20) unsigned NOT NULL auto_increment, @@ -163,7 +170,7 @@ CREATE TABLE $wpdb->posts ( post_mime_type varchar(100) NOT NULL default '', comment_count bigint(20) NOT NULL default '0', PRIMARY KEY (ID), - KEY post_name (post_name), + KEY post_name (post_name($max_index_length)), KEY type_status_date (post_type,post_status,post_date,ID), KEY post_parent (post_parent), KEY post_author (post_author) @@ -213,7 +220,7 @@ CREATE TABLE $wpdb->posts ( meta_value longtext, PRIMARY KEY (umeta_id), KEY user_id (user_id), - KEY meta_key (meta_key) + KEY meta_key (meta_key($max_index_length)) ) $charset_collate;\n"; // Global tables @@ -261,7 +268,7 @@ CREATE TABLE $wpdb->site ( domain varchar(200) NOT NULL default '', path varchar(100) NOT NULL default '', PRIMARY KEY (id), - KEY domain (domain,path) + KEY domain (domain(140),path(51)) ) $charset_collate; CREATE TABLE $wpdb->sitemeta ( meta_id bigint(20) NOT NULL auto_increment, @@ -269,7 +276,7 @@ CREATE TABLE $wpdb->sitemeta ( meta_key varchar(255) default NULL, meta_value longtext, PRIMARY KEY (meta_id), - KEY meta_key (meta_key), + KEY meta_key (meta_key($max_index_length)), KEY site_id (site_id) ) $charset_collate; CREATE TABLE $wpdb->signups ( @@ -288,7 +295,7 @@ CREATE TABLE $wpdb->signups ( KEY activation_key (activation_key), KEY user_email (user_email), KEY user_login_email (user_login,user_email), - KEY domain_path (domain,path) + KEY domain_path (domain(140),path(51)) ) $charset_collate;"; switch ( $scope ) { @@ -910,7 +917,7 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam $site_admins = get_site_option( 'site_admins' ); } - $welcome_email = __( 'Dear User, + $welcome_email = __( 'Howdy USERNAME, Your new SITE_NAME site has been successfully set up at: BLOG_URL