Make WordPress Core

Changeset 14872


Ignore:
Timestamp:
05/25/2010 07:24:10 AM (16 years ago)
Author:
wpmuguru
Message:

ensure unique term_id when global terms enabled, see #13482

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r14871 r14872  
    12361236                } else {
    12371237                        $max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
    1238                         $max_global_id += mt_rand( 100, 400 );
    1239                         $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
     1238                        $max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
     1239                        $new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );
     1240                        $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
    12401241                        $global_id = $wpdb->insert_id;
    12411242                }
Note: See TracChangeset for help on using the changeset viewer.