mirror of
git://develop.git.wordpress.org/
synced 2025-02-24 08:33:35 +01:00
Options fixes from donncha. fixes #1859
git-svn-id: https://develop.svn.wordpress.org/trunk@3023 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fb234acd09
commit
2077dcaf16
@ -58,6 +58,7 @@ case 'update':
|
|||||||
$new_val = 'closed';
|
$new_val = 'closed';
|
||||||
if ($new_val !== $old_val) {
|
if ($new_val !== $old_val) {
|
||||||
$result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'");
|
$result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'");
|
||||||
|
wp_cache_set($option->option_name, $new_val, 'options');
|
||||||
$any_changed++;
|
$any_changed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,8 +267,11 @@ function get_settings($setting) {
|
|||||||
$value = wp_cache_get($setting, 'options');
|
$value = wp_cache_get($setting, 'options');
|
||||||
|
|
||||||
if ( false === $value ) {
|
if ( false === $value ) {
|
||||||
$value = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
$value = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
||||||
wp_cache_add($setting, $value, 'options');
|
if( is_object( $value ) ) {
|
||||||
|
$value = $value->option_value;
|
||||||
|
wp_cache_set($setting, $value, 'options');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If home is not set use siteurl.
|
// If home is not set use siteurl.
|
||||||
@ -343,7 +346,7 @@ function update_option($option_name, $newvalue) {
|
|||||||
|
|
||||||
// If it's not there add it
|
// If it's not there add it
|
||||||
if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
|
if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
|
||||||
add_option($option_name);
|
add_option($option_name, $newvalue);
|
||||||
|
|
||||||
wp_cache_set($option_name, $newvalue, 'options');
|
wp_cache_set($option_name, $newvalue, 'options');
|
||||||
|
|
||||||
@ -365,14 +368,14 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// Make sure the option doesn't already exist
|
// Make sure the option doesn't already exist
|
||||||
if ( false !== get_option($name, 'options') )
|
if ( false !== get_option($name) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$original = $value;
|
$original = $value;
|
||||||
if ( is_array($value) || is_object($value) )
|
if ( is_array($value) || is_object($value) )
|
||||||
$value = serialize($value);
|
$value = serialize($value);
|
||||||
|
|
||||||
wp_cache_add($name, $value, 'options');
|
wp_cache_set($name, $value, 'options');
|
||||||
|
|
||||||
$name = $wpdb->escape($name);
|
$name = $wpdb->escape($name);
|
||||||
$value = $wpdb->escape($value);
|
$value = $wpdb->escape($value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user