616 | | if ( wp_using_ext_object_cache() ) { |
617 | | $value = wp_cache_get( $transient, 'transient' ); |
618 | | } else { |
619 | | $transient_option = '_transient_' . $transient; |
620 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
621 | | // If option is not in alloptions, it is not autoloaded and thus has a timeout |
622 | | $alloptions = wp_load_alloptions(); |
623 | | if ( !isset( $alloptions[$transient_option] ) ) { |
624 | | $transient_timeout = '_transient_timeout_' . $transient; |
625 | | $timeout = get_option( $transient_timeout ); |
626 | | if ( false !== $timeout && $timeout < time() ) { |
627 | | delete_option( $transient_option ); |
628 | | delete_option( $transient_timeout ); |
629 | | $value = false; |
630 | | } |
| 616 | $transient_option = '_transient_' . $transient; |
| 617 | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 618 | // If option is not in alloptions, it is not autoloaded and thus has a timeout |
| 619 | $alloptions = wp_load_alloptions(); |
| 620 | if ( !isset( $alloptions[$transient_option] ) ) { |
| 621 | $transient_timeout = '_transient_timeout_' . $transient; |
| 622 | $timeout = get_option( $transient_timeout ); |
| 623 | if ( false !== $timeout && $timeout < time() ) { |
| 624 | delete_option( $transient_option ); |
| 625 | delete_option( $transient_timeout ); |
| 626 | $value = false; |
682 | | if ( wp_using_ext_object_cache() ) { |
683 | | $result = wp_cache_set( $transient, $value, 'transient', $expiration ); |
| 678 | $transient_timeout = '_transient_timeout_' . $transient; |
| 679 | $transient = '_transient_' . $transient; |
| 680 | if ( false === get_option( $transient ) ) { |
| 681 | $autoload = 'yes'; |
| 682 | if ( $expiration ) { |
| 683 | $autoload = 'no'; |
| 684 | add_option( $transient_timeout, time() + $expiration, '', 'no' ); |
| 685 | } |
| 686 | $result = add_option( $transient, $value, '', $autoload ); |
685 | | $transient_timeout = '_transient_timeout_' . $transient; |
686 | | $transient = '_transient_' . $transient; |
687 | | if ( false === get_option( $transient ) ) { |
688 | | $autoload = 'yes'; |
689 | | if ( $expiration ) { |
690 | | $autoload = 'no'; |
| 688 | // If expiration is requested, but the transient has no timeout option, |
| 689 | // delete, then re-create transient rather than update. |
| 690 | $update = true; |
| 691 | if ( $expiration ) { |
| 692 | if ( false === get_option( $transient_timeout ) ) { |
| 693 | delete_option( $transient ); |
693 | | $result = add_option( $transient, $value, '', $autoload ); |
694 | | } else { |
695 | | // If expiration is requested, but the transient has no timeout option, |
696 | | // delete, then re-create transient rather than update. |
697 | | $update = true; |
698 | | if ( $expiration ) { |
699 | | if ( false === get_option( $transient_timeout ) ) { |
700 | | delete_option( $transient ); |
701 | | add_option( $transient_timeout, time() + $expiration, '', 'no' ); |
702 | | $result = add_option( $transient, $value, '', 'no' ); |
703 | | $update = false; |
704 | | } else { |
705 | | update_option( $transient_timeout, time() + $expiration ); |
706 | | } |
707 | | } |
708 | | if ( $update ) { |
709 | | $result = update_option( $transient, $value ); |
710 | | } |
| 700 | } |
| 701 | if ( $update ) { |
| 702 | $result = update_option( $transient, $value ); |