Don't query the timeout for core transients that do not have a timeout. Avoids useless queries on non-existent site options.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-11 19:43:22 +00:00
parent 51066760c6
commit 525d2a8609
1 changed files with 10 additions and 6 deletions

View File

@ -3463,13 +3463,17 @@ function get_site_transient($transient) {
if ( $_wp_using_ext_object_cache ) {
$value = wp_cache_get($transient, 'site-transient');
} else {
// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
$no_timeout = array('update_core', 'update_plugins', 'update_themes');
$transient_option = '_site_transient_' . esc_sql($transient);
$transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
$timeout = get_site_option($transient_timeout);
if ( false !== $timeout && $timeout < time() ) {
delete_site_option($transient_option);
delete_site_option($transient_timeout);
return false;
if ( !in_array($transient, $no_timeout) ) {
$transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
$timeout = get_site_option($transient_timeout);
if ( false !== $timeout && $timeout < time() ) {
delete_site_option($transient_option);
delete_site_option($transient_timeout);
return false;
}
}
$value = get_site_option($transient_option);