WordPress.org

Make WordPress Core

Changeset 12403


Ignore:
Timestamp:
12/15/09 16:00:23 (4 years ago)
Author:
ryan
Message:

Use ON DUPLICATE KEY UPDATE when inserting options to avoid duplicate entry errors. fixes #11437

File:
1 edited

Legend:

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

    r12368 r12403  
    601601    } 
    602602 
    603     $wpdb->insert($wpdb->options, array('option_name' => $name, 'option_value' => $value, 'autoload' => $autoload) ); 
     603    $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $name, $value, $autoload ) ); 
    604604 
    605605    do_action( "add_option_{$name}", $name, $value ); 
Note: See TracChangeset for help on using the changeset viewer.