From 65dae9a05ffda025903d4ea9b5a017cbfa6d404b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 11 Feb 2010 19:43:22 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@13056 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c452fb08c2..1ebfcd69ff 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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);