Changeset 13148
- Timestamp:
- 02/14/2010 10:39:46 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r13142 r13148 346 346 $wpdb->suppress_errors( $suppress ); 347 347 348 if ( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values 348 // Has to be get_row instead of get_var because of funkiness with 0, false, null values 349 if ( is_object( $row ) ) { 349 350 $value = $row->option_value; 350 351 wp_cache_add( $option, $value, 'options' ); … … 480 481 * @uses apply_filters() Calls 'pre_update_option_$option' hook to allow overwriting the 481 482 * option value to be stored. 483 * @uses do_action() Calls 'update_option' hook before updating the option. 482 484 * @uses do_action() Calls 'update_option_$option' and 'updated_option' hooks on success. 483 485 * … … 512 514 $newvalue = maybe_serialize( $newvalue ); 513 515 514 do_action( 'update_option', $option, $oldvalue, $newvalue ); 516 do_action( 'update_option', $option, $oldvalue, $newvalue ); // $newvalue may be serialized. 515 517 if ( ! defined( 'WP_INSTALLING' ) ) { 516 518 $alloptions = wp_load_alloptions(); … … 551 553 * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton 552 554 * 555 * @uses do_action() Calls 'add_option' hook before adding the option. 553 556 * @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success. 554 557 * … … 609 612 * 610 613 * @package WordPress 611 * @subpackage Option 614 * @subpackage Option 612 615 * @since 1.2.0 613 616 * 614 617 * @uses do_action() Calls 'delete_option' hook before option is deleted. 615 * @uses do_action() Calls 'deleted_option' hookon success.618 * @uses do_action() Calls 'deleted_option' and 'delete_option_$option' hooks on success. 616 619 * 617 620 * @param string $option Name of option to remove. 618 * @return bool True, if succeed. False, iffailure.621 * @return bool True, if option is successfully deleted. False on failure. 619 622 */ 620 623 function delete_option( $option ) { … … 643 646 } 644 647 if ( $result ) { 648 do_action( "delete_option_$option", $option ); 645 649 do_action( 'deleted_option', $option ); 646 650 return true; … … 656 660 * @subpackage Transient 657 661 * 662 * @uses do_action() Calls 'delete_transient_$transient' hook before transient is deleted. 663 * @uses do_action() Calls 'deleted_transient' hook on success. 664 * 658 665 * @param string $transient Transient name. Expected to not be SQL-escaped 659 666 * @return bool true if successful, false otherwise … … 662 669 global $_wp_using_ext_object_cache; 663 670 664 do_action( 'delete_transient_' . $transient );671 do_action( 'delete_transient_' . $transient, $transient ); 665 672 666 673 if ( $_wp_using_ext_object_cache ) { 667 returnwp_cache_delete( $transient, 'transient' );674 $result = wp_cache_delete( $transient, 'transient' ); 668 675 } else { 669 $transient = '_transient_' . esc_sql( $transient ); 670 return delete_option( $transient ); 671 } 676 $option = '_transient_' . esc_sql( $transient ); 677 $result = delete_option( $option ); 678 } 679 680 if ( $result ) 681 do_action( 'deleted_transient', $transient ); 682 return $result; 672 683 } 673 684 … … 734 745 * @uses apply_filters() Calls 'pre_set_transient_$transient' hook to allow overwriting the 735 746 * transient value to be stored. 747 * @uses do_action() Calls 'set_transient_$transient' and 'setted_transient' hooks on success. 736 748 * 737 749 * @param string $transient Transient name. Expected to not be SQL-escaped … … 746 758 747 759 if ( $_wp_using_ext_object_cache ) { 748 returnwp_cache_set( $transient, $value, 'transient', $expiration );760 $result = wp_cache_set( $transient, $value, 'transient', $expiration ); 749 761 } else { 750 762 $transient_timeout = '_transient_timeout_' . $transient; … … 755 767 if ( $expiration ) { 756 768 $autoload = 'no'; 757 add_option( $transient_timeout, time() + $expiration, '', 'no');769 add_option( $transient_timeout, time() + $expiration, '', 'no' ); 758 770 } 759 return add_option($transient, $value, '', $autoload);771 $result = add_option( $transient, $value, '', $autoload ); 760 772 } else { 761 773 if ( $expiration ) 762 774 update_option( $transient_timeout, time() + $expiration ); 763 return update_option($transient, $value);775 $result = update_option( $transient, $value ); 764 776 } 765 777 } 778 if ( $result ) { 779 do_action( 'set_transient_' . $transient ); 780 do_action( 'setted_transient', $transient ); 781 } 782 return $result; 766 783 } 767 784 … … 3467 3484 } 3468 3485 3469 do_action( "delete_site_option_{$option}", $option ); 3470 do_action( "delete_site_option", $option ); 3471 return $result; 3486 if ( $result ) { 3487 do_action( "delete_site_option_{$option}", $option ); 3488 do_action( "delete_site_option", $option ); 3489 return true; 3490 } 3491 return false; 3472 3492 } 3473 3493 … … 3526 3546 * @subpackage Transient 3527 3547 * 3548 * @uses do_action() Calls 'delete_site_transient_$transient' hook before transient is deleted. 3549 * @uses do_action() Calls 'deleted_site_transient' hook on success. 3550 * 3528 3551 * @param string $transient Transient name. Expected to not be SQL-escaped 3529 3552 * @return bool True if successful, false otherwise … … 3532 3555 global $_wp_using_ext_object_cache; 3533 3556 3557 do_action( 'delete_site_transient_' . $transient, $transient ); 3534 3558 if ( $_wp_using_ext_object_cache ) { 3535 3559 $result = wp_cache_delete( $transient, 'site-transient' ); 3536 3560 } else { 3537 $transient = '_site_transient_' . esc_sql( $transient ); 3538 $result = delete_site_option( $transient ); 3539 } 3561 $option = '_site_transient_' . esc_sql( $transient ); 3562 $result = delete_site_option( $option ); 3563 } 3564 if ( $result ) 3565 do_action( 'deleted_site_transient', $transient ); 3540 3566 return $result; 3541 3567 } … … 3601 3627 * @subpackage Transient 3602 3628 * 3629 * @uses apply_filters() Calls 'pre_set_site_transient_$transient' hook to allow overwriting the 3630 * transient value to be stored. 3631 * @uses do_action() Calls 'set_site_transient_$transient' and 'setted_site_transient' hooks on success. 3632 * 3603 3633 * @param string $transient Transient name. Expected to not be SQL-escaped 3604 3634 * @param mixed $value Transient value. … … 3608 3638 function set_site_transient( $transient, $value, $expiration = 0 ) { 3609 3639 global $_wp_using_ext_object_cache; 3640 3641 $value = apply_filters( 'pre_set_site_transient_' . $transient, $value ); 3610 3642 3611 3643 if ( $_wp_using_ext_object_cache ) { … … 3624 3656 $result = update_site_option( $transient, $value ); 3625 3657 } 3658 } 3659 if ( $result ) { 3660 do_action( 'set_site_transient_' . $transient ); 3661 do_action( 'setted_site_transient', $transient ); 3626 3662 } 3627 3663 return $result;
Note: See TracChangeset
for help on using the changeset viewer.