WordPress.org

Make WordPress Core

Ticket #11649: 11649-distinct .patch

File 11649-distinct .patch, 980 bytes (added by hakre, 4 years ago)
  • wp-admin/includes/upgrade.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    16881688        // Upgrade versions prior to 2.9 
    16891689        if ( $wp_current_db_version < 11557 ) { 
    16901690                // Delete duplicate options.  Keep the option with the highest option_id. 
    1691                 $delete_options = $wpdb->get_col("SELECT o1.option_id FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 ON o2.option_name = o1.option_name AND o2.option_id > o1.option_id"); 
     1691                $delete_options = $wpdb->get_col("SELECT DISTINCT o1.option_id FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 ON o2.option_name = o1.option_name AND o2.option_id > o1.option_id"); 
    16921692                if ( !empty($delete_options) ) { 
    16931693                        $delete_options = implode(',', $delete_options); 
    16941694                        $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($delete_options)");