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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2013-09-06 18:10:09 +00:00
parent 74092c3960
commit d7cc1f506a
5 changed files with 41 additions and 35 deletions

View File

@@ -476,8 +476,6 @@ function _is_valid_nav_menu_item( $item ) {
* @return mixed $items array of menu items, else false.
*/
function wp_get_nav_menu_items( $menu, $args = array() ) {
global $_wp_using_ext_object_cache;
$menu = wp_get_nav_menu_object( $menu );
if ( ! $menu )
@@ -504,7 +502,7 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
return false;
// Get all posts and terms at once to prime the caches
if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache ) {
if ( empty( $fetched[$menu->term_id] ) || wp_using_ext_object_cache() ) {
$fetched[$menu->term_id] = true;
$posts = array();
$terms = array();