Changeset 12933 for trunk/wp-admin/includes/upgrade.php
- Timestamp:
- 02/03/2010 01:00:57 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/upgrade.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/upgrade.php
r12931 r12933 104 104 $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug')); 105 105 106 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 107 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); 106 if ( is_multisite() ) { 107 $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); 108 if ( $cat_id == null ) { 109 $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) ); 110 $cat_id = $wpdb->insert_id; 111 } 112 update_option('default_category', $cat_id); 113 } else { 114 $cat_id = 1; 115 } 116 117 $wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 118 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); 119 $cat_tt_id = $wpdb->insert_id; 108 120 109 121 // Default link category … … 112 124 $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug')); 113 125 114 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 115 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7)); 126 if ( is_multisite() ) { 127 $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); 128 if ( $blogroll_id == null ) { 129 $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) ); 130 $blogroll_id = $wpdb->insert_id; 131 } 132 update_option('default_link_category', $blogroll_id); 133 } else { 134 $blogroll_id = 2; 135 } 136 137 $wpdb->insert( $wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 138 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7)); 139 $blogroll_tt_id = $wpdb->insert_id; 116 140 117 141 // Now drop in some default links … … 154 178 foreach ( $default_links as $link ) { 155 179 $wpdb->insert( $wpdb->links, $link); 156 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 2, 'object_id' => $wpdb->insert_id) );180 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $blogroll_tt_id, 'object_id' => $wpdb->insert_id) ); 157 181 } 158 182 … … 191 215 'post_content_filtered' => '' 192 216 )); 193 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 1, 'object_id' => 1) );217 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1) ); 194 218 195 219 // Default comment
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)