Changeset 43630 for trunk/src/wp-admin/includes/schema.php
- Timestamp:
- 09/05/2018 12:49:29 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/schema.php
r43629 r43630 55 55 // Blog specific tables. 56 56 $blog_tables = "CREATE TABLE $wpdb->termmeta ( 57 58 59 60 61 62 63 57 meta_id bigint(20) unsigned NOT NULL auto_increment, 58 term_id bigint(20) unsigned NOT NULL default '0', 59 meta_key varchar(255) default NULL, 60 meta_value longtext, 61 PRIMARY KEY (meta_id), 62 KEY term_id (term_id), 63 KEY meta_key (meta_key($max_index_length)) 64 64 ) $charset_collate; 65 65 CREATE TABLE $wpdb->terms ( … … 91 91 ) $charset_collate; 92 92 CREATE TABLE $wpdb->commentmeta ( 93 94 95 96 97 98 99 93 meta_id bigint(20) unsigned NOT NULL auto_increment, 94 comment_id bigint(20) unsigned NOT NULL default '0', 95 meta_key varchar(255) default NULL, 96 meta_value longtext, 97 PRIMARY KEY (meta_id), 98 KEY comment_id (comment_id), 99 KEY meta_key (meta_key($max_index_length)) 100 100 ) $charset_collate; 101 101 CREATE TABLE $wpdb->comments ( 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 102 comment_ID bigint(20) unsigned NOT NULL auto_increment, 103 comment_post_ID bigint(20) unsigned NOT NULL default '0', 104 comment_author tinytext NOT NULL, 105 comment_author_email varchar(100) NOT NULL default '', 106 comment_author_url varchar(200) NOT NULL default '', 107 comment_author_IP varchar(100) NOT NULL default '', 108 comment_date datetime NOT NULL default '0000-00-00 00:00:00', 109 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 110 comment_content text NOT NULL, 111 comment_karma int(11) NOT NULL default '0', 112 comment_approved varchar(20) NOT NULL default '1', 113 comment_agent varchar(255) NOT NULL default '', 114 comment_type varchar(20) NOT NULL default '', 115 comment_parent bigint(20) unsigned NOT NULL default '0', 116 user_id bigint(20) unsigned NOT NULL default '0', 117 PRIMARY KEY (comment_ID), 118 KEY comment_post_ID (comment_post_ID), 119 KEY comment_approved_date_gmt (comment_approved,comment_date_gmt), 120 KEY comment_date_gmt (comment_date_gmt), 121 KEY comment_parent (comment_parent), 122 KEY comment_author_email (comment_author_email(10)) 123 123 ) $charset_collate; 124 124 CREATE TABLE $wpdb->links ( 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 125 link_id bigint(20) unsigned NOT NULL auto_increment, 126 link_url varchar(255) NOT NULL default '', 127 link_name varchar(255) NOT NULL default '', 128 link_image varchar(255) NOT NULL default '', 129 link_target varchar(25) NOT NULL default '', 130 link_description varchar(255) NOT NULL default '', 131 link_visible varchar(20) NOT NULL default 'Y', 132 link_owner bigint(20) unsigned NOT NULL default '1', 133 link_rating int(11) NOT NULL default '0', 134 link_updated datetime NOT NULL default '0000-00-00 00:00:00', 135 link_rel varchar(255) NOT NULL default '', 136 link_notes mediumtext NOT NULL, 137 link_rss varchar(255) NOT NULL default '', 138 PRIMARY KEY (link_id), 139 KEY link_visible (link_visible) 140 140 ) $charset_collate; 141 141 CREATE TABLE $wpdb->options ( 142 143 144 145 146 147 142 option_id bigint(20) unsigned NOT NULL auto_increment, 143 option_name varchar(191) NOT NULL default '', 144 option_value longtext NOT NULL, 145 autoload varchar(20) NOT NULL default 'yes', 146 PRIMARY KEY (option_id), 147 UNIQUE KEY option_name (option_name) 148 148 ) $charset_collate; 149 149 CREATE TABLE $wpdb->postmeta ( 150 151 152 153 154 155 156 150 meta_id bigint(20) unsigned NOT NULL auto_increment, 151 post_id bigint(20) unsigned NOT NULL default '0', 152 meta_key varchar(255) default NULL, 153 meta_value longtext, 154 PRIMARY KEY (meta_id), 155 KEY post_id (post_id), 156 KEY meta_key (meta_key($max_index_length)) 157 157 ) $charset_collate; 158 158 CREATE TABLE $wpdb->posts ( 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 159 ID bigint(20) unsigned NOT NULL auto_increment, 160 post_author bigint(20) unsigned NOT NULL default '0', 161 post_date datetime NOT NULL default '0000-00-00 00:00:00', 162 post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 163 post_content longtext NOT NULL, 164 post_title text NOT NULL, 165 post_excerpt text NOT NULL, 166 post_status varchar(20) NOT NULL default 'publish', 167 comment_status varchar(20) NOT NULL default 'open', 168 ping_status varchar(20) NOT NULL default 'open', 169 post_password varchar(255) NOT NULL default '', 170 post_name varchar(200) NOT NULL default '', 171 to_ping text NOT NULL, 172 pinged text NOT NULL, 173 post_modified datetime NOT NULL default '0000-00-00 00:00:00', 174 post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', 175 post_content_filtered longtext NOT NULL, 176 post_parent bigint(20) unsigned NOT NULL default '0', 177 guid varchar(255) NOT NULL default '', 178 menu_order int(11) NOT NULL default '0', 179 post_type varchar(20) NOT NULL default 'post', 180 post_mime_type varchar(100) NOT NULL default '', 181 comment_count bigint(20) NOT NULL default '0', 182 PRIMARY KEY (ID), 183 KEY post_name (post_name($max_index_length)), 184 KEY type_status_date (post_type,post_status,post_date,ID), 185 KEY post_parent (post_parent), 186 KEY post_author (post_author) 187 187 ) $charset_collate;\n"; 188 188 189 189 // Single site users table. The multisite flavor of the users table is handled below. 190 190 $users_single_table = "CREATE TABLE $wpdb->users ( 191 192 193 194 195 196 197 198 199 200 201 202 203 204 191 ID bigint(20) unsigned NOT NULL auto_increment, 192 user_login varchar(60) NOT NULL default '', 193 user_pass varchar(255) NOT NULL default '', 194 user_nicename varchar(50) NOT NULL default '', 195 user_email varchar(100) NOT NULL default '', 196 user_url varchar(100) NOT NULL default '', 197 user_registered datetime NOT NULL default '0000-00-00 00:00:00', 198 user_activation_key varchar(255) NOT NULL default '', 199 user_status int(11) NOT NULL default '0', 200 display_name varchar(250) NOT NULL default '', 201 PRIMARY KEY (ID), 202 KEY user_login_key (user_login), 203 KEY user_nicename (user_nicename), 204 KEY user_email (user_email) 205 205 ) $charset_collate;\n"; 206 206 207 207 // Multisite users table 208 208 $users_multi_table = "CREATE TABLE $wpdb->users ( 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 209 ID bigint(20) unsigned NOT NULL auto_increment, 210 user_login varchar(60) NOT NULL default '', 211 user_pass varchar(255) NOT NULL default '', 212 user_nicename varchar(50) NOT NULL default '', 213 user_email varchar(100) NOT NULL default '', 214 user_url varchar(100) NOT NULL default '', 215 user_registered datetime NOT NULL default '0000-00-00 00:00:00', 216 user_activation_key varchar(255) NOT NULL default '', 217 user_status int(11) NOT NULL default '0', 218 display_name varchar(250) NOT NULL default '', 219 spam tinyint(2) NOT NULL default '0', 220 deleted tinyint(2) NOT NULL default '0', 221 PRIMARY KEY (ID), 222 KEY user_login_key (user_login), 223 KEY user_nicename (user_nicename), 224 KEY user_email (user_email) 225 225 ) $charset_collate;\n"; 226 226 227 227 // Usermeta. 228 228 $usermeta_table = "CREATE TABLE $wpdb->usermeta ( 229 230 231 232 233 234 235 229 umeta_id bigint(20) unsigned NOT NULL auto_increment, 230 user_id bigint(20) unsigned NOT NULL default '0', 231 meta_key varchar(255) default NULL, 232 meta_value longtext, 233 PRIMARY KEY (umeta_id), 234 KEY user_id (user_id), 235 KEY meta_key (meta_key($max_index_length)) 236 236 ) $charset_collate;\n"; 237 237 … … 245 245 // Multisite global tables. 246 246 $ms_global_tables = "CREATE TABLE $wpdb->blogs ( 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 247 blog_id bigint(20) NOT NULL auto_increment, 248 site_id bigint(20) NOT NULL default '0', 249 domain varchar(200) NOT NULL default '', 250 path varchar(100) NOT NULL default '', 251 registered datetime NOT NULL default '0000-00-00 00:00:00', 252 last_updated datetime NOT NULL default '0000-00-00 00:00:00', 253 public tinyint(2) NOT NULL default '1', 254 archived tinyint(2) NOT NULL default '0', 255 mature tinyint(2) NOT NULL default '0', 256 spam tinyint(2) NOT NULL default '0', 257 deleted tinyint(2) NOT NULL default '0', 258 lang_id int(11) NOT NULL default '0', 259 PRIMARY KEY (blog_id), 260 KEY domain (domain(50),path(5)), 261 KEY lang_id (lang_id) 262 262 ) $charset_collate; 263 263 CREATE TABLE $wpdb->blog_versions ( 264 265 266 267 268 264 blog_id bigint(20) NOT NULL default '0', 265 db_version varchar(20) NOT NULL default '', 266 last_updated datetime NOT NULL default '0000-00-00 00:00:00', 267 PRIMARY KEY (blog_id), 268 KEY db_version (db_version) 269 269 ) $charset_collate; 270 270 CREATE TABLE $wpdb->blogmeta ( 271 272 273 274 275 276 277 271 meta_id bigint(20) unsigned NOT NULL auto_increment, 272 blog_id bigint(20) NOT NULL default '0', 273 meta_key varchar(255) default NULL, 274 meta_value longtext, 275 PRIMARY KEY (meta_id), 276 KEY meta_key (meta_key($max_index_length)), 277 KEY blog_id (blog_id) 278 278 ) $charset_collate; 279 279 CREATE TABLE $wpdb->registration_log ( 280 281 282 283 284 285 286 280 ID bigint(20) NOT NULL auto_increment, 281 email varchar(255) NOT NULL default '', 282 IP varchar(30) NOT NULL default '', 283 blog_id bigint(20) NOT NULL default '0', 284 date_registered datetime NOT NULL default '0000-00-00 00:00:00', 285 PRIMARY KEY (ID), 286 KEY IP (IP) 287 287 ) $charset_collate; 288 288 CREATE TABLE $wpdb->site ( 289 290 291 292 293 289 id bigint(20) NOT NULL auto_increment, 290 domain varchar(200) NOT NULL default '', 291 path varchar(100) NOT NULL default '', 292 PRIMARY KEY (id), 293 KEY domain (domain(140),path(51)) 294 294 ) $charset_collate; 295 295 CREATE TABLE $wpdb->sitemeta ( 296 297 298 299 300 301 302 296 meta_id bigint(20) NOT NULL auto_increment, 297 site_id bigint(20) NOT NULL default '0', 298 meta_key varchar(255) default NULL, 299 meta_value longtext, 300 PRIMARY KEY (meta_id), 301 KEY meta_key (meta_key($max_index_length)), 302 KEY site_id (site_id) 303 303 ) $charset_collate; 304 304 CREATE TABLE $wpdb->signups ( 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 305 signup_id bigint(20) NOT NULL auto_increment, 306 domain varchar(200) NOT NULL default '', 307 path varchar(100) NOT NULL default '', 308 title longtext NOT NULL, 309 user_login varchar(60) NOT NULL default '', 310 user_email varchar(100) NOT NULL default '', 311 registered datetime NOT NULL default '0000-00-00 00:00:00', 312 activated datetime NOT NULL default '0000-00-00 00:00:00', 313 active tinyint(1) NOT NULL default '0', 314 activation_key varchar(50) NOT NULL default '', 315 meta longtext, 316 PRIMARY KEY (signup_id), 317 KEY activation_key (activation_key), 318 KEY user_email (user_email), 319 KEY user_login_email (user_login,user_email), 320 KEY domain_path (domain(140),path(51)) 321 321 ) $charset_collate;"; 322 322 … … 564 564 565 565 $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; 566 $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress. WP.PreparedSQL.NotPrepared566 $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 567 567 568 568 $insert = ''; … … 587 587 588 588 if ( ! empty( $insert ) ) { 589 $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress. WP.PreparedSQL.NotPrepared589 $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 590 590 } 591 591 … … 1207 1207 ); 1208 1208 1209 $misc_exts = array(1209 $misc_exts = array( 1210 1210 // Images. 1211 1211 'jpg', … … 1291 1291 $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value ); 1292 1292 } 1293 $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress. WP.PreparedSQL.NotPrepared1293 $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 1294 1294 } 1295 1295 … … 1328 1328 } 1329 1329 1330 $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress. WP.PreparedSQL.NotPrepared1330 $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 1331 1331 1332 1332 wp_cache_set( 'last_changed', microtime(), 'sites' );
Note: See TracChangeset
for help on using the changeset viewer.