Pass false returned for timed out transients through transient_$transient filter.

This brings the same behaviour as external object caches to the default database
backend.

Props johnbillion. Fixes #24685.

Built from https://develop.svn.wordpress.org/trunk@25075


git-svn-id: http://core.svn.wordpress.org/trunk@25060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jon Cave 2013-08-21 19:14:09 +00:00
parent b82ff57666
commit 55f60d7af4

View File

@ -461,12 +461,13 @@ function get_transient( $transient ) {
if ( get_option( $transient_timeout ) < time() ) { if ( get_option( $transient_timeout ) < time() ) {
delete_option( $transient_option ); delete_option( $transient_option );
delete_option( $transient_timeout ); delete_option( $transient_timeout );
return false; $value = false;
} }
} }
} }
$value = get_option( $transient_option ); if ( ! isset( $value ) )
$value = get_option( $transient_option );
} }
return apply_filters( 'transient_' . $transient, $value ); return apply_filters( 'transient_' . $transient, $value );
@ -1029,11 +1030,12 @@ function get_site_transient( $transient ) {
if ( false !== $timeout && $timeout < time() ) { if ( false !== $timeout && $timeout < time() ) {
delete_site_option( $transient_option ); delete_site_option( $transient_option );
delete_site_option( $transient_timeout ); delete_site_option( $transient_timeout );
return false; $value = false;
} }
} }
$value = get_site_option( $transient_option ); if ( ! isset( $value ) )
$value = get_site_option( $transient_option );
} }
return apply_filters( 'site_transient_' . $transient, $value ); return apply_filters( 'site_transient_' . $transient, $value );