Ticket #4429: add_option_branches_2.2.diff
File add_option_branches_2.2.diff, 1.4 KB (added by , 18 years ago) |
---|
-
wp-includes/functions.php
354 354 355 355 wp_protect_special_option($name); 356 356 357 // Make sure the option doesn't already exist we can check thecache before we ask for a db query357 // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query 358 358 $notoptions = wp_cache_get('notoptions', 'options'); 359 if ( is_array($notoptions) && isset($notoptions[$name]) ) { 360 unset($notoptions[$name]); 361 wp_cache_set('notoptions', $notoptions, 'options'); 362 } elseif ( false !== get_option($name) ) { 359 if ( !is_array($notoptions) || !isset($notoptions[$name]) ) 360 if ( false !== get_option($name) ) 363 361 return; 364 }365 362 366 363 $value = maybe_serialize($value); 364 $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; 367 365 368 366 if ( 'yes' == $autoload ) { 369 367 $alloptions = wp_load_alloptions(); … … 373 371 wp_cache_set($name, $value, 'options'); 374 372 } 375 373 374 // This option exists now 375 $notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh 376 if ( is_array($notoptions) && isset($notoptions[$name]) ) { 377 unset($notoptions[$name]); 378 wp_cache_set('notoptions', $notoptions, 'options'); 379 } 380 376 381 $name = $wpdb->escape($name); 377 382 $value = $wpdb->escape($value); 378 383 $description = $wpdb->escape($description);