]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/schema.php
WordPress 4.3
[autoinstalls/wordpress.git] / wp-admin / includes / schema.php
index 1fc432f51ee448cc9334171346f921f77868f718..8c84054803aa6fc42816d61496ef2695e6c282d7 100644 (file)
@@ -8,14 +8,17 @@
  * @subpackage Administration
  */
 
-// Declare these as global in case schema.php is included from a function.
+/**
+ * Declare these as global in case schema.php is included from a function.
+ *
+ * @global wpdb   $wpdb
+ * @global array  $wp_queries
+ * @global string $charset_collate
+ */
 global $wpdb, $wp_queries, $charset_collate;
 
 /**
  * The database character collate.
- * @var string
- * @global string
- * @name $charset_collate
  */
 $charset_collate = $wpdb->get_charset_collate();
 
@@ -24,6 +27,8 @@ $charset_collate = $wpdb->get_charset_collate();
  *
  * @since 3.3.0
  *
+ * @global wpdb $wpdb
+ *
  * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
  * @param int $blog_id Optional. The blog ID for which to retrieve SQL. Default is the current blog ID.
  * @return string The SQL needed to create the requested tables.
@@ -44,6 +49,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 +63,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),
UNIQUE 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 +91,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 +148,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 +175,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 +225,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 +273,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 +281,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 +300,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 ) {
@@ -324,8 +336,10 @@ $wp_queries = wp_get_db_schema( 'all' );
  * Create WordPress options and set the default values.
  *
  * @since 1.5.0
- * @uses $wpdb
- * @uses $wp_db_version
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @global int  $wp_db_version
+ * @global int  $wp_current_db_version
  */
 function populate_options() {
        global $wpdb, $wp_db_version, $wp_current_db_version;
@@ -482,6 +496,9 @@ function populate_options() {
 
        // 3.5
        'link_manager_enabled' => 0,
+
+       // 4.3.0
+       'finished_splitting_shared_terms' => 1,
        );
 
        // 3.3
@@ -854,6 +871,11 @@ endif;
  *
  * @since 3.0.0
  *
+ * @global wpdb       $wpdb
+ * @global object     $current_site
+ * @global int        $wp_db_version
+ * @global WP_Rewrite $wp_rewrite
+ *
  * @param int $network_id ID of network to populate.
  * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful,
  *                       so the error code must be checked) or failure.
@@ -909,12 +931,14 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
                $site_admins = get_site_option( 'site_admins' );
        }
 
-       $welcome_email = __( 'Dear User,
+       /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
+       $welcome_email = __( 'Howdy USERNAME,
 
 Your new SITE_NAME site has been successfully set up at:
 BLOG_URL
 
 You can log in to the administrator account with the following information:
+
 Username: USERNAME
 Password: PASSWORD
 Log in here: BLOG_URLwp-login.php