Don't use hard query. Remove unneeded line. fixes #1858
git-svn-id: http://svn.automattic.com/wordpress/trunk@3052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
815bd99a96
commit
0c2c997bab
|
@ -340,16 +340,18 @@ function update_option($option_name, $newvalue) {
|
|||
$newvalue = trim($newvalue);
|
||||
|
||||
// If the new and old values are the same, no need to update.
|
||||
if ( $newvalue == get_option($option_name) )
|
||||
$oldvalue = get_option($option_name);
|
||||
if ( $newvalue == $oldvalue )
|
||||
return true;
|
||||
|
||||
if ( false === $oldvalue ) {
|
||||
add_option($option_name, $newvalue);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( is_array($newvalue) || is_object($newvalue) )
|
||||
$newvalue = serialize($newvalue);
|
||||
|
||||
// If it's not there add it
|
||||
if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
|
||||
add_option($option_name, $newvalue);
|
||||
|
||||
wp_cache_set($option_name, $newvalue, 'options');
|
||||
|
||||
$newvalue = $wpdb->escape($newvalue);
|
||||
|
@ -373,7 +375,6 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
|
|||
if ( false !== get_option($name) )
|
||||
return;
|
||||
|
||||
$original = $value;
|
||||
if ( is_array($value) || is_object($value) )
|
||||
$value = serialize($value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue