Ticket #11644: defaults_cleanup.diff
| File defaults_cleanup.diff, 5.1 KB (added by , 16 years ago) |
|---|
-
wp-includes/ms-functions.php
1419 1419 update_option('admin_email', ''); 1420 1420 $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); 1421 1421 1422 // Default category1423 $wpdb->insert( $wpdb->terms, array('term_id' => 1, 'name' => __('Uncategorized'), 'slug' => sanitize_title(__('Uncategorized')), 'term_group' => 0) );1424 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => 1, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1) );1425 1426 // Default link category1427 $cat_name = __('Blogroll');1428 $cat_slug = sanitize_title($cat_name);1429 1430 $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );1431 1432 if ( $blogroll_id == null ) {1433 $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );1434 $blogroll_id = $wpdb->insert_id;1435 }1436 $wpdb->insert( $wpdb->terms, array('term_id' => $blogroll_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );1437 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $blogroll_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 2) );1438 update_option('default_link_category', $blogroll_id);1439 1440 1422 // remove all perms 1441 1423 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'user_level') ); 1442 1424 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'capabilities') ); -
wp-admin/includes/upgrade.php
103 103 /* translators: Default category slug */ 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 } 108 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; 120 109 121 // Default link category 110 122 $cat_name = __('Blogroll'); 111 123 /* translators: Default link category slug */ 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 } 116 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; 140 117 141 // Now drop in some default links 118 142 $default_links = array(); 119 143 $default_links[] = array( 'link_url' => 'http://codex.wordpress.org/', … … 153 177 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 159 183 // First post … … 190 214 'pinged' => '', 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 196 220 $first_comment_author = __('Mr WordPress');