| Server IP : 104.21.28.229 / Your IP : 216.73.216.142 Web Server : Apache/2 System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : mienphi ( 1014) PHP Version : 8.2.14 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/mienphi/public_html/wp-content/plugins/buddypress/bp-blogs/ |
Upload File : |
<?php
/**
* BuddyPress Blogs Caching.
*
* Caching functions handle the clearing of cached objects and pages on specific
* actions throughout BuddyPress.
*
* @package BuddyPress
* @subpackage BlogsCache
* @since 1.5.0
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* Slurp up blogmeta for a specified set of blogs.
*
* It grabs all blogmeta associated with all of the blogs passed
* in $blog_ids and adds it to the WP cache. This improves efficiency when
* using querying blogmeta inline.
*
* @param int|string|array|bool $blog_ids Accepts a single blog ID, or a comma-
* separated list or array of blog IDs.
*/
function bp_blogs_update_meta_cache( $blog_ids = false ) {
$cache_args = array(
'object_ids' => $blog_ids,
'object_type' => buddypress()->blogs->id,
'object_column' => 'blog_id',
'cache_group' => 'bp_blog_meta',
'meta_table' => buddypress()->blogs->table_name_blogmeta,
);
bp_update_meta_cache( $cache_args );
}
/**
* Clear the blog object cache.
*
* @since 1.0.0
*
* @param int $blog_id ID of the current blog.
* @param int $user_id ID of the user whose blog cache should be cleared.
*/
function bp_blogs_clear_blog_object_cache( $blog_id = 0, $user_id = 0 ) {
if ( ! empty( $user_id ) ) {
wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' );
}
wp_cache_delete( 'bp_total_blogs', 'bp' );
}
// List actions to clear object caches on.
add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 );
add_action( 'bp_insert_site', 'bp_blogs_clear_blog_object_cache', 10, 2 );
add_action( 'bp_blogs_remove_blog', 'bp_blogs_clear_blog_object_cache' );
// List actions to clear super cached pages on, if super cache is installed.
add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
add_action( 'bp_blogs_remove_comment', 'bp_core_clear_cache' );
add_action( 'bp_blogs_remove_post', 'bp_core_clear_cache' );
add_action( 'bp_blogs_remove_blog_for_user', 'bp_core_clear_cache' );
add_action( 'bp_blogs_remove_blog', 'bp_core_clear_cache' );
add_action( 'bp_blogs_new_blog_comment', 'bp_core_clear_cache' );
add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' );
add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' );
add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' );