/** * Starts the NXTClass object cache. * * If an object-cache.php file exists in the nxt-content directory, * it uses that drop-in as an external object cache. * * @access private * @since 3.0.0 */ function nxt_start_object_cache() { global $_nxt_using_ext_object_cache; $first_init = false; if (!function_exists('nxt_cache_init')) { if (file_exists(nxt_CONTENT_DIR . '/object-cache.php')) { require_once nxt_CONTENT_DIR . '/object-cache.php'; $_nxt_using_ext_object_cache = true; } else { require_once ABSPATH . nxtINC . '/cache.php'; $_nxt_using_ext_object_cache = false; } $first_init = true; } else { if (!$_nxt_using_ext_object_cache && file_exists(nxt_CONTENT_DIR . '/object-cache.php')) { // Sometimes advanced-cache.php can load object-cache.php before it is loaded here. // This breaks the function_exists check above and can result in $_nxt_using_ext_object_cache // being set incorrectly. Double check if an external cache exists. $_nxt_using_ext_object_cache = true; } } // If cache supports reset, reset instead of init if already initialized. // Reset signals to the cache that global IDs have changed and it may need to update keys // and cleanup caches. if (!$first_init && function_exists('nxt_cache_reset')) { nxt_cache_reset(); } else { nxt_cache_init(); } if (function_exists('nxt_cache_add_global_groups')) { nxt_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts')); nxt_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins')); } }
// Load the object cache class require_once BB_OBJECT_CACHE_FUNCTIONS_INCLUDE; if (BB_OBJECT_CACHE_FUNCTIONS_INCLUDE === $_internal_object_cache_functions_include) { $_bb_using_ext_object_cache = false; } else { $_bb_using_ext_object_cache = true; } } unset($_internal_object_cache_functions_include); // Instantiate the $nxt_object_cache object using nxt_cache_init() if (function_exists('nxt_cache_init')) { // Clear NXTClass cache if it exists already - maybe should save and re-load? unset($nxt_object_cache); nxt_cache_init(); if (function_exists('nxt_cache_add_global_groups')) { nxt_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'useremail', 'usernicename')); } } /** * Load mapping class for BackPress to store options */ require_once BB_PATH . BB_INC . 'class.bp-options.php'; require_once BACKPRESS_PATH . 'functions.bp-options.php'; /** * Load nxt_Http class */ if (!class_exists('nxt_Http')) { require_once BACKPRESS_PATH . 'class.nxt-http.php'; } /** * Determine language settings and load i10n libraries as required
/** * Add's 'bp' to global group of network wide cachable objects * * @package BuddyPress Core */ function bp_core_add_global_group() { nxt_cache_init(); nxt_cache_add_global_groups(array('bp')); }
/** * Restore the current blog, after calling switch_to_blog() * * @see switch_to_blog() * @since MU * * @return bool True on success, False if we're already on the current blog */ function restore_current_blog() { global $table_prefix, $nxtdb, $blog_id, $switched, $switched_stack, $nxt_roles, $nxt_object_cache; if (!$switched) { return false; } if (!is_array($switched_stack)) { return false; } $blog = array_pop($switched_stack); if ($blog_id == $blog) { do_action('switch_blog', $blog, $blog); /* If we still have items in the switched stack, consider ourselves still 'switched' */ $switched = is_array($switched_stack) && count($switched_stack) > 0; return true; } $nxtdb->set_blog_id($blog); $prev_blog_id = $blog_id; $blog_id = $blog; $table_prefix = $nxtdb->prefix; if (is_object($nxt_roles)) { $nxtdb->suppress_errors(); if (method_exists($nxt_roles, '_init')) { $nxt_roles->_init(); } elseif (method_exists($nxt_roles, '__construct')) { $nxt_roles->__construct(); } $nxtdb->suppress_errors(false); } if (did_action('init')) { $current_user = nxt_get_current_user(); if (is_object($current_user)) { $current_user->for_blog($blog_id); } } if (is_object($nxt_object_cache) && isset($nxt_object_cache->global_groups)) { $global_groups = $nxt_object_cache->global_groups; } else { $global_groups = false; } nxt_cache_init(); if (function_exists('nxt_cache_add_global_groups')) { if (is_array($global_groups)) { nxt_cache_add_global_groups($global_groups); } else { nxt_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts')); } nxt_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins')); } do_action('switch_blog', $blog_id, $prev_blog_id); /* If we still have items in the switched stack, consider ourselves still 'switched' */ $switched = is_array($switched_stack) && count($switched_stack) > 0; return true; }