branch | wordpress |
changeset 132 | 4d4862461b8d |
parent 109 | 03b0d1493584 |
131:a4642baaf829 | 132:4d4862461b8d |
---|---|
17 $charset_collate = ''; |
17 $charset_collate = ''; |
18 |
18 |
19 // Declare these as global in case schema.php is included from a function. |
19 // Declare these as global in case schema.php is included from a function. |
20 global $wpdb, $wp_queries; |
20 global $wpdb, $wp_queries; |
21 |
21 |
22 if ( $wpdb->has_cap( 'collation' ) ) { |
22 if ( ! empty($wpdb->charset) ) |
23 if ( ! empty($wpdb->charset) ) |
23 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
24 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
24 if ( ! empty($wpdb->collate) ) |
25 if ( ! empty($wpdb->collate) ) |
25 $charset_collate .= " COLLATE $wpdb->collate"; |
26 $charset_collate .= " COLLATE $wpdb->collate"; |
|
27 } |
|
28 |
26 |
29 /** Create WordPress database tables SQL */ |
27 /** Create WordPress database tables SQL */ |
30 $wp_queries = "CREATE TABLE $wpdb->terms ( |
28 $wp_queries = "CREATE TABLE $wpdb->terms ( |
31 term_id bigint(20) unsigned NOT NULL auto_increment, |
29 term_id bigint(20) unsigned NOT NULL auto_increment, |
32 name varchar(200) NOT NULL default '', |
30 name varchar(200) NOT NULL default '', |
51 object_id bigint(20) unsigned NOT NULL default 0, |
49 object_id bigint(20) unsigned NOT NULL default 0, |
52 term_taxonomy_id bigint(20) unsigned NOT NULL default 0, |
50 term_taxonomy_id bigint(20) unsigned NOT NULL default 0, |
53 term_order int(11) NOT NULL default 0, |
51 term_order int(11) NOT NULL default 0, |
54 PRIMARY KEY (object_id,term_taxonomy_id), |
52 PRIMARY KEY (object_id,term_taxonomy_id), |
55 KEY term_taxonomy_id (term_taxonomy_id) |
53 KEY term_taxonomy_id (term_taxonomy_id) |
54 ) $charset_collate; |
|
55 CREATE TABLE $wpdb->commentmeta ( |
|
56 meta_id bigint(20) unsigned NOT NULL auto_increment, |
|
57 comment_id bigint(20) unsigned NOT NULL default '0', |
|
58 meta_key varchar(255) default NULL, |
|
59 meta_value longtext, |
|
60 PRIMARY KEY (meta_id), |
|
61 KEY comment_id (comment_id), |
|
62 KEY meta_key (meta_key) |
|
56 ) $charset_collate; |
63 ) $charset_collate; |
57 CREATE TABLE $wpdb->comments ( |
64 CREATE TABLE $wpdb->comments ( |
58 comment_ID bigint(20) unsigned NOT NULL auto_increment, |
65 comment_ID bigint(20) unsigned NOT NULL auto_increment, |
59 comment_post_ID bigint(20) unsigned NOT NULL default '0', |
66 comment_post_ID bigint(20) unsigned NOT NULL default '0', |
60 comment_author tinytext NOT NULL, |
67 comment_author tinytext NOT NULL, |
97 option_id bigint(20) unsigned NOT NULL auto_increment, |
104 option_id bigint(20) unsigned NOT NULL auto_increment, |
98 blog_id int(11) NOT NULL default '0', |
105 blog_id int(11) NOT NULL default '0', |
99 option_name varchar(64) NOT NULL default '', |
106 option_name varchar(64) NOT NULL default '', |
100 option_value longtext NOT NULL, |
107 option_value longtext NOT NULL, |
101 autoload varchar(20) NOT NULL default 'yes', |
108 autoload varchar(20) NOT NULL default 'yes', |
102 PRIMARY KEY (option_id,blog_id,option_name), |
109 PRIMARY KEY (option_id), |
103 KEY option_name (option_name) |
110 UNIQUE KEY option_name (option_name) |
104 ) $charset_collate; |
111 ) $charset_collate; |
105 CREATE TABLE $wpdb->postmeta ( |
112 CREATE TABLE $wpdb->postmeta ( |
106 meta_id bigint(20) unsigned NOT NULL auto_increment, |
113 meta_id bigint(20) unsigned NOT NULL auto_increment, |
107 post_id bigint(20) unsigned NOT NULL default '0', |
114 post_id bigint(20) unsigned NOT NULL default '0', |
108 meta_key varchar(255) default NULL, |
115 meta_key varchar(255) default NULL, |
178 $guessurl = wp_guess_url(); |
185 $guessurl = wp_guess_url(); |
179 |
186 |
180 do_action('populate_options'); |
187 do_action('populate_options'); |
181 |
188 |
182 if ( ini_get('safe_mode') ) { |
189 if ( ini_get('safe_mode') ) { |
183 // Safe mode screws up mkdir(), so we must use a flat structure. |
190 // Safe mode can break mkdir() so use a flat structure by default. |
184 $uploads_use_yearmonth_folders = 0; |
191 $uploads_use_yearmonth_folders = 0; |
185 $upload_path = WP_CONTENT_DIR; |
|
186 } else { |
192 } else { |
187 $uploads_use_yearmonth_folders = 1; |
193 $uploads_use_yearmonth_folders = 1; |
188 $upload_path = WP_CONTENT_DIR . '/uploads'; |
|
189 } |
194 } |
190 |
195 |
191 $options = array( |
196 $options = array( |
192 'siteurl' => $guessurl, |
197 'siteurl' => $guessurl, |
193 'blogname' => __('My Blog'), |
198 'blogname' => __('My Blog'), |
198 'use_balanceTags' => 0, |
203 'use_balanceTags' => 0, |
199 'use_smilies' => 1, |
204 'use_smilies' => 1, |
200 'require_name_email' => 1, |
205 'require_name_email' => 1, |
201 'comments_notify' => 1, |
206 'comments_notify' => 1, |
202 'posts_per_rss' => 10, |
207 'posts_per_rss' => 10, |
203 'rss_excerpt_length' => 50, |
|
204 'rss_use_excerpt' => 0, |
208 'rss_use_excerpt' => 0, |
205 'mailserver_url' => 'mail.example.com', |
209 'mailserver_url' => 'mail.example.com', |
206 'mailserver_login' => 'login@example.com', |
210 'mailserver_login' => 'login@example.com', |
207 'mailserver_pass' => 'password', |
211 'mailserver_pass' => 'password', |
208 'mailserver_port' => 110, |
212 'mailserver_port' => 110, |
255 'default_role' => 'subscriber', |
259 'default_role' => 'subscriber', |
256 'db_version' => $wp_db_version, |
260 'db_version' => $wp_db_version, |
257 |
261 |
258 // 2.0.1 |
262 // 2.0.1 |
259 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, |
263 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, |
260 'upload_path' => $upload_path, |
264 'upload_path' => '', |
261 |
265 |
262 // 2.0.3 |
266 // 2.0.3 |
263 'secret' => wp_generate_password(64), |
267 'secret' => wp_generate_password(64), |
264 |
268 |
265 // 2.1 |
269 // 2.1 |
303 'widget_categories' => array(), |
307 'widget_categories' => array(), |
304 'widget_text' => array(), |
308 'widget_text' => array(), |
305 'widget_rss' => array(), |
309 'widget_rss' => array(), |
306 |
310 |
307 // 2.8 |
311 // 2.8 |
308 'timezone_string' => '' |
312 'timezone_string' => '', |
313 |
|
314 // 2.9 |
|
315 'embed_autourls' => 1, |
|
316 'embed_size_w' => '', |
|
317 'embed_size_h' => 600, |
|
309 ); |
318 ); |
310 |
319 |
311 // Set autoload to no for these options |
320 // Set autoload to no for these options |
312 $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); |
321 $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); |
313 |
322 |
337 // in case it is set, but blank, update "home" |
346 // in case it is set, but blank, update "home" |
338 if ( !__get_option('home') ) update_option('home', $guessurl); |
347 if ( !__get_option('home') ) update_option('home', $guessurl); |
339 |
348 |
340 // Delete unused options |
349 // Delete unused options |
341 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', |
350 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', |
342 'page_uris', 'rewrite_rules', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed'); |
351 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length'); |
343 foreach ($unusedoptions as $option) |
352 foreach ($unusedoptions as $option) |
344 delete_option($option); |
353 delete_option($option); |
354 |
|
355 // delete obsolete magpie stuff |
|
356 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
|
345 } |
357 } |
346 |
358 |
347 /** |
359 /** |
348 * Execute WordPress role creation for the various WordPress versions. |
360 * Execute WordPress role creation for the various WordPress versions. |
349 * |
361 * |