[wpmu-trac] Re: [WordPress MU Trac] #335: wp_*_options should have UNIQUE index on blog_id AND option_name

WordPress MU Trac wpmu-trac at lists.automattic.com
Mon Jun 18 22:14:05 GMT 2007


#335: wp_*_options should have UNIQUE index on blog_id AND option_name
--------------------------+-------------------------------------------------
 Reporter:  gwagenknecht  |        Owner:  somebody
     Type:  defect        |       Status:  new     
 Priority:  normal        |    Milestone:          
Component:  component1    |      Version:          
 Severity:  normal        |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Comment (by supergeek):

 This is the solution I used for this problem.

 In '''wp-admin/upgrade-schema.php''' line 86

 Change:
 {{{
 KEY option_name (option_name)
 }}}

 To:
 {{{
 UNIQUE option_name (option_name)
 }}}

 In '''wp-includes/functions.php''', change the query on line 396 to read
 as follows:
 {{{
 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value,
 option_description, autoload)"
 ." VALUES ('$name', '$value', '$description', '$autoload')"
 ." ON DUPLICATE KEY UPDATE"
 ." option_value = '$value', option_description = '$description', autoload
 = '$autoload'");
 }}}

 I am not a professional PHP programmer nor very experienced with WPmu, so
 this is not a guaranteed fix, just something that has worked for me on my
 site.  I'm not sure about blog_id.

-- 
Ticket URL: <http://trac.mu.wordpress.org/ticket/335#comment:2>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser


More information about the wpmu-trac mailing list