Make WordPress Core

Changeset 3023


Ignore:
Timestamp:
11/09/2005 06:15:55 PM (19 years ago)
Author:
ryan
Message:

Options fixes from donncha. fixes #1859

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options.php

    r2763 r3023  
    5959            if ($new_val !== $old_val) {
    6060                $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'");
     61                wp_cache_set($option->option_name, $new_val, 'options');
    6162                $any_changed++;
    6263            }
  • trunk/wp-includes/functions.php

    r3012 r3023  
    268268
    269269    if ( false === $value ) {
    270         $value = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
    271         wp_cache_add($setting, $value, 'options');
     270        $value = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
     271        if( is_object( $value ) ) {
     272            $value = $value->option_value;
     273            wp_cache_set($setting, $value, 'options');
     274        }
    272275    }
    273276
     
    344347    // If it's not there add it
    345348    if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
    346         add_option($option_name);
     349        add_option($option_name, $newvalue);
    347350
    348351    wp_cache_set($option_name, $newvalue, 'options');
     
    366369
    367370    // Make sure the option doesn't already exist
    368     if ( false !== get_option($name, 'options') )
     371    if ( false !== get_option($name) )
    369372        return;
    370373
     
    373376        $value = serialize($value);
    374377
    375     wp_cache_add($name, $value, 'options');
     378    wp_cache_set($name, $value, 'options');
    376379
    377380    $name = $wpdb->escape($name);
Note: See TracChangeset for help on using the changeset viewer.