Changeset 54240 for trunk/src/wp-admin/includes/upgrade.php
- Timestamp:
- 09/20/2022 02:49:25 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r53897 r54240 160 160 $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); 161 161 162 if ( global_terms_enabled() ) { 163 $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); 164 if ( null == $cat_id ) { 165 $wpdb->insert( 166 $wpdb->sitecategories, 167 array( 168 'cat_ID' => 0, 169 'cat_name' => $cat_name, 170 'category_nicename' => $cat_slug, 171 'last_updated' => current_time( 'mysql', true ), 172 ) 173 ); 174 $cat_id = $wpdb->insert_id; 175 } 176 update_option( 'default_category', $cat_id ); 177 } else { 178 $cat_id = 1; 179 } 162 $cat_id = 1; 180 163 181 164 $wpdb->insert( … … 3538 3521 } 3539 3522 3540 if ( ! function_exists( 'install_global_terms' ) ) :3541 /**3542 * Install global terms.3543 *3544 * @since 3.0.03545 *3546 * @global wpdb $wpdb WordPress database abstraction object.3547 * @global string $charset_collate3548 */3549 function install_global_terms() {3550 global $wpdb, $charset_collate;3551 $ms_queries = "3552 CREATE TABLE $wpdb->sitecategories (3553 cat_ID bigint(20) NOT NULL auto_increment,3554 cat_name varchar(55) NOT NULL default '',3555 category_nicename varchar(200) NOT NULL default '',3556 last_updated timestamp NOT NULL,3557 PRIMARY KEY (cat_ID),3558 KEY category_nicename (category_nicename),3559 KEY last_updated (last_updated)3560 ) $charset_collate;3561 ";3562 // Now create tables.3563 dbDelta( $ms_queries );3564 }3565 endif;3566 3567 3523 /** 3568 3524 * Determine if global tables should be upgraded.
Note: See TracChangeset
for help on using the changeset viewer.