Ticket #25015: 25015.patch
File 25015.patch, 2.9 KB (added by , 11 years ago) |
---|
-
src/wp-includes/option.php
244 244 $newvalue = maybe_serialize( $newvalue ); 245 245 246 246 do_action( 'update_option', $option, $oldvalue, $_newvalue ); 247 if ( ! defined( 'WP_INSTALLING' ) ) {248 $alloptions = wp_load_alloptions();249 if ( isset( $alloptions[$option] ) ) {250 $alloptions[$option] = $newvalue;251 wp_cache_set( 'alloptions', $alloptions, 'options' );252 } else {253 wp_cache_set( $option, $newvalue, 'options' );254 }255 }256 247 257 248 $result = $wpdb->update( $wpdb->options, array( 'option_value' => $newvalue ), array( 'option_name' => $option ) ); 258 249 259 250 if ( $result ) { 251 if ( ! defined( 'WP_INSTALLING' ) ) { 252 $alloptions = wp_load_alloptions(); 253 if ( isset( $alloptions[ $option ] ) ) { 254 $alloptions[ $option ] = $newvalue; 255 wp_cache_set( 'alloptions', $alloptions, 'options' ); 256 } else { 257 wp_cache_set( $option, $newvalue, 'options' ); 258 } 259 } 260 260 261 do_action( "update_option_{$option}", $oldvalue, $_newvalue ); 261 262 do_action( 'updated_option', $option, $oldvalue, $_newvalue ); 262 263 return true; … … 316 317 $value = maybe_serialize( $value ); 317 318 $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; 318 319 do_action( 'add_option', $option, $_value ); 319 if ( ! defined( 'WP_INSTALLING' ) ) {320 if ( 'yes' == $autoload ) {321 $alloptions = wp_load_alloptions();322 $alloptions[$option] = $value;323 wp_cache_set( 'alloptions', $alloptions, 'options' );324 } else {325 wp_cache_set( $option, $value, 'options' );326 }327 }328 320 329 // This option exists now330 $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh331 if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {332 unset( $notoptions[$option] );333 wp_cache_set( 'notoptions', $notoptions, 'options' );334 }335 336 321 $result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $value, $autoload ) ); 337 322 338 323 if ( $result ) { 324 if ( ! defined( 'WP_INSTALLING' ) ) { 325 if ( 'yes' == $autoload ) { 326 $alloptions = wp_load_alloptions(); 327 $alloptions[ $option ] = $value; 328 wp_cache_set( 'alloptions', $alloptions, 'options' ); 329 } else { 330 wp_cache_set( $option, $value, 'options' ); 331 } 332 } 333 334 // This option exists now 335 $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh 336 if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { 337 unset( $notoptions[ $option ] ); 338 wp_cache_set( 'notoptions', $notoptions, 'options' ); 339 } 340 339 341 do_action( "add_option_{$option}", $option, $_value ); 340 342 do_action( 'added_option', $option, $_value ); 341 343 return true;