Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().

Fixes #21401.



git-svn-id: https://develop.svn.wordpress.org/trunk@25289 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-06 18:09:24 +00:00
parent 6bad3b660a
commit 22278ec6a9
5 changed files with 41 additions and 35 deletions

View File

@@ -1946,7 +1946,7 @@ class WP_Query {
* @return array List of posts.
*/
function get_posts() {
global $wpdb, $user_ID, $_wp_using_ext_object_cache;
global $wpdb, $user_ID;
$this->parse_query();
@@ -1996,7 +1996,7 @@ class WP_Query {
$q['suppress_filters'] = false;
if ( !isset($q['cache_results']) ) {
if ( $_wp_using_ext_object_cache )
if ( wp_using_ext_object_cache() )
$q['cache_results'] = false;
else
$q['cache_results'] = true;