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
This commit is contained in:
parent
d440214a7b
commit
65dae9a05f
@ -3463,13 +3463,17 @@ function get_site_transient($transient) {
|
|||||||
if ( $_wp_using_ext_object_cache ) {
|
if ( $_wp_using_ext_object_cache ) {
|
||||||
$value = wp_cache_get($transient, 'site-transient');
|
$value = wp_cache_get($transient, 'site-transient');
|
||||||
} else {
|
} 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_option = '_site_transient_' . esc_sql($transient);
|
||||||
$transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
|
if ( !in_array($transient, $no_timeout) ) {
|
||||||
$timeout = get_site_option($transient_timeout);
|
$transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
|
||||||
if ( false !== $timeout && $timeout < time() ) {
|
$timeout = get_site_option($transient_timeout);
|
||||||
delete_site_option($transient_option);
|
if ( false !== $timeout && $timeout < time() ) {
|
||||||
delete_site_option($transient_timeout);
|
delete_site_option($transient_option);
|
||||||
return false;
|
delete_site_option($transient_timeout);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = get_site_option($transient_option);
|
$value = get_site_option($transient_option);
|
||||||
|
Loading…
Reference in New Issue
Block a user