Changeset 13971
- Timestamp:
- 07/23/2024 01:32:42 AM (8 months ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-cache.php
r13890 r13971 1 1 <?php 2 2 /** 3 * Functions related to the BuddyPress Activity component and the WP Cache.3 * BuddyPress Activity Caching. 4 4 * 5 5 * @package BuddyPress … … 27 27 28 28 $cache_args = array( 29 'object_ids' 30 'object_type' 29 'object_ids' => $activity_ids, 30 'object_type' => $bp->activity->id, 31 31 'object_column' => 'activity_id', 32 32 'cache_group' => 'activity_meta', 33 'meta_table' 34 'cache_key_prefix' => 'bp_activity_meta' 33 'meta_table' => $bp->activity->table_name_meta, 34 'cache_key_prefix' => 'bp_activity_meta', 35 35 ); 36 36 … … 85 85 return $without_last_activity && $with_last_activity; 86 86 } 87 add_action( 'bp_activity_delete', 88 add_action( 'bp_activity_add', 89 add_action( 'added_activity_meta', 87 add_action( 'bp_activity_delete', 'bp_activity_reset_cache_incrementor' ); 88 add_action( 'bp_activity_add', 'bp_activity_reset_cache_incrementor' ); 89 add_action( 'added_activity_meta', 'bp_activity_reset_cache_incrementor' ); 90 90 add_action( 'updated_activity_meta', 'bp_activity_reset_cache_incrementor' ); 91 91 add_action( 'deleted_activity_meta', 'bp_activity_reset_cache_incrementor' ); -
trunk/src/bp-blogs/bp-blogs-cache.php
r12606 r13971 2 2 /** 3 3 * BuddyPress Blogs Caching. 4 *5 * Caching functions handle the clearing of cached objects and pages on specific6 * actions throughout BuddyPress.7 4 * 8 5 * @package BuddyPress … … 35 32 bp_update_meta_cache( $cache_args ); 36 33 } 34 37 35 /** 38 36 * Clear the blog object cache. … … 45 43 function bp_blogs_clear_blog_object_cache( $blog_id = 0, $user_id = 0 ) { 46 44 if ( ! empty( $user_id ) ) { 47 wp_cache_delete( 'bp_blogs_of_user_' 45 wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' ); 48 46 wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' ); 49 47 } … … 54 52 // List actions to clear object caches on. 55 53 add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 ); 56 add_action( 'bp_insert_site', 57 add_action( 'bp_blogs_remove_blog', 54 add_action( 'bp_insert_site', 'bp_blogs_clear_blog_object_cache', 10, 2 ); 55 add_action( 'bp_blogs_remove_blog', 'bp_blogs_clear_blog_object_cache' ); 58 56 59 57 // List actions to clear super cached pages on, if super cache is installed. 60 58 add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' ); 61 add_action( 'bp_blogs_remove_comment', 62 add_action( 'bp_blogs_remove_post', 59 add_action( 'bp_blogs_remove_comment', 'bp_core_clear_cache' ); 60 add_action( 'bp_blogs_remove_post', 'bp_core_clear_cache' ); 63 61 add_action( 'bp_blogs_remove_blog_for_user', 'bp_core_clear_cache' ); 64 add_action( 'bp_blogs_remove_blog', 65 add_action( 'bp_blogs_new_blog_comment', 66 add_action( 'bp_blogs_new_blog_post', 67 add_action( 'bp_blogs_new_blog', 68 add_action( 'bp_blogs_remove_data', 62 add_action( 'bp_blogs_remove_blog', 'bp_core_clear_cache' ); 63 add_action( 'bp_blogs_new_blog_comment', 'bp_core_clear_cache' ); 64 add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' ); 65 add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' ); 66 add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' ); -
trunk/src/bp-core/bp-core-cache.php
r13904 r13971 1 1 <?php 2 2 /** 3 * BuddyPress Core Caching Functions. 4 * 5 * Caching functions handle the clearing of cached objects and pages on specific 6 * actions throughout BuddyPress. 3 * BuddyPress Core Caching. 7 4 * 8 5 * @package BuddyPress 9 * @subpackage C ache6 * @subpackage Core 10 7 * @since 1.5.0 11 8 */ -
trunk/src/bp-friends/bp-friends-cache.php
r13092 r13971 3 3 * BuddyPress Friends Caching. 4 4 * 5 * Caching functions handle the clearing of cached objects and pages on specific6 * actions throughout BuddyPress.7 *8 5 * @package BuddyPress 9 * @subpackage FriendsCach ing6 * @subpackage FriendsCache 10 7 * @since 1.5.0 11 8 */ … … 21 18 * @param int $friendship_id ID of the friendship whose two members should 22 19 * have their friends cache busted. 23 * @return bool24 20 */ 25 21 function friends_clear_friend_object_cache( $friendship_id ) { 26 22 $friendship = new BP_Friends_Friendship( $friendship_id ); 27 if ( ! $friendship ) { 28 return false; 23 24 if ( empty( $friendship->id ) ) { 25 return; 29 26 } 30 27 … … 55 52 56 53 // Clear incremented cache. 57 $friendship = new stdClass;54 $friendship = new stdClass(); 58 55 $friendship->initiator_user_id = $initiator_user_id; 59 56 $friendship->friend_user_id = $friend_user_id; … … 135 132 * @since 3.0.0 136 133 * 137 * @param BP_Friends_Friendship $friendship The friendship object.134 * @param BP_Friends_Friendship|stdClass $friendship The friendship object. 138 135 */ 139 136 function bp_friends_delete_cached_friendships_on_friendship_save( $friendship ) { … … 144 141 145 142 // List actions to clear super cached pages on, if super cache is installed. 146 add_action( 'friends_friendship_rejected', 147 add_action( 'friends_friendship_accepted', 148 add_action( 'friends_friendship_deleted', 143 add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' ); 144 add_action( 'friends_friendship_accepted', 'bp_core_clear_cache' ); 145 add_action( 'friends_friendship_deleted', 'bp_core_clear_cache' ); 149 146 add_action( 'friends_friendship_requested', 'bp_core_clear_cache' ); -
trunk/src/bp-groups/bp-groups-cache.php
r13890 r13971 3 3 * BuddyPress Groups Caching. 4 4 * 5 * Caching functions handle the clearing of cached objects and pages on specific6 * actions throughout BuddyPress.7 *8 5 * @package BuddyPress 9 * @subpackage Groups 6 * @subpackage GroupsCache 10 7 * @since 1.5.0 11 8 */ … … 35 32 36 33 $cache_args = array( 37 'object_ids' 38 'object_type' 34 'object_ids' => $group_ids, 35 'object_type' => $bp->groups->id, 39 36 'cache_group' => 'group_meta', 40 37 'object_column' => 'group_id', 41 'meta_table' 42 'cache_key_prefix' => 'bp_groups_groupmeta' 38 'meta_table' => $bp->groups->table_name_groupmeta, 39 'cache_key_prefix' => 'bp_groups_groupmeta', 43 40 ); 44 41 … … 56 53 wp_cache_delete( 'bp_total_group_count', 'bp' ); 57 54 } 58 add_action( 'groups_group_deleted', 59 add_action( 'groups_settings_updated', 60 add_action( 'groups_details_updated', 61 add_action( 'groups_group_avatar_updated', 55 add_action( 'groups_group_deleted', 'groups_clear_group_object_cache' ); 56 add_action( 'groups_settings_updated', 'groups_clear_group_object_cache' ); 57 add_action( 'groups_details_updated', 'groups_clear_group_object_cache' ); 58 add_action( 'groups_group_avatar_updated', 'groups_clear_group_object_cache' ); 62 59 add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' ); 63 60 … … 72 69 wp_cache_delete( $group_id, 'bp_groups' ); 73 70 } 74 add_action( 'groups_delete_group', 75 add_action( 'groups_update_group', 76 add_action( 'groups_details_updated', 71 add_action( 'groups_delete_group', 'bp_groups_delete_group_cache' ); 72 add_action( 'groups_update_group', 'bp_groups_delete_group_cache' ); 73 add_action( 'groups_details_updated', 'bp_groups_delete_group_cache' ); 77 74 add_action( 'groups_settings_updated', 'bp_groups_delete_group_cache' ); 78 75 … … 115 112 function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) { 116 113 // Clears the 'total groups' cache for each member in a group. 117 foreach ( (array) $user_ids as $user_id ) 114 foreach ( (array) $user_ids as $user_id ) { 118 115 groups_clear_group_user_object_cache( $group_obj->id, $user_id ); 116 } 119 117 } 120 118 add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10, 2 ); … … 123 121 * Clear a user's cached total group invite count. 124 122 * 125 * Count is cleared when an invit eis accepted, rejected or deleted.123 * Count is cleared when an invitation is accepted, rejected or deleted. 126 124 * 127 125 * @since 2.0.0 … … 177 175 wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' ); 178 176 } 179 add_action( 'groups_join_group', 180 add_action( 'groups_leave_group', 181 add_action( 'groups_ban_member', 182 add_action( 'groups_unban_member', 177 add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 ); 178 add_action( 'groups_leave_group', 'groups_clear_group_user_object_cache', 10, 2 ); 179 add_action( 'groups_ban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 180 add_action( 'groups_unban_member', 'groups_clear_group_user_object_cache', 10, 2 ); 183 181 add_action( 'groups_uninvite_user', 'groups_clear_group_user_object_cache', 10, 2 ); 184 182 add_action( 'groups_remove_member', 'groups_clear_group_user_object_cache', 10, 2 ); … … 196 194 } 197 195 add_action( 'groups_promote_member', 'groups_clear_group_administrator_cache' ); 198 add_action( 'groups_demote_member', 199 add_action( 'groups_delete_group', 196 add_action( 'groups_demote_member', 'groups_clear_group_administrator_cache' ); 197 add_action( 'groups_delete_group', 'groups_clear_group_administrator_cache' ); 200 198 201 199 /** … … 265 263 * @since 5.0.0 266 264 * 267 * @param BP_Invitation object$invitation Characteristics of the invitation just saved.265 * @param BP_Invitation $invitation Characteristics of the invitation just saved. 268 266 */ 269 267 function bp_groups_clear_user_group_cache_on_invitation_save( BP_Invitation $invitation ) { … … 274 272 wp_cache_delete( $invitation->id, 'bp_groups_invitations_as_memberships' ); 275 273 } 276 add_action( 'bp_invitation_after_save', 'bp_groups_clear_user_group_cache_on_invitation_save' , 10, 2);274 add_action( 'bp_invitation_after_save', 'bp_groups_clear_user_group_cache_on_invitation_save' ); 277 275 278 276 /** … … 285 283 */ 286 284 function bp_groups_clear_user_group_cache_on_invitation_change( $args ) { 287 $args['fields' ]= 'ids';285 $args['fields'] = 'ids'; 288 286 $affected_invitation_ids = groups_get_invites( $args ); 289 287 foreach ( $affected_invitation_ids as $invitation_id ) { … … 320 318 * 321 319 * @since 2.7.0 322 *323 * @return bool324 320 */ 325 321 function bp_groups_reset_cache_incrementor() { 326 returnbp_core_reset_incrementor( 'bp_groups' );327 } 328 add_action( 'groups_group_after_save', 329 add_action( 'bp_groups_delete_group', 330 add_action( 'updated_group_meta', 331 add_action( 'deleted_group_meta', 332 add_action( 'added_group_meta', 322 bp_core_reset_incrementor( 'bp_groups' ); 323 } 324 add_action( 'groups_group_after_save', 'bp_groups_reset_cache_incrementor' ); 325 add_action( 'bp_groups_delete_group', 'bp_groups_reset_cache_incrementor' ); 326 add_action( 'updated_group_meta', 'bp_groups_reset_cache_incrementor' ); 327 add_action( 'deleted_group_meta', 'bp_groups_reset_cache_incrementor' ); 328 add_action( 'added_group_meta', 'bp_groups_reset_cache_incrementor' ); 333 329 add_action( 'groups_member_after_remove', 'bp_groups_reset_cache_incrementor' ); 334 330 … … 345 341 * @param array $tt_ids Array of term taxonomy IDs. 346 342 * @param string $taxonomy Taxonomy slug. 347 * @return bool348 343 */ 349 344 function bp_groups_reset_cache_incrementor_on_group_term_change( $object_id, $terms, $tt_ids, $taxonomy ) { 350 345 $tax_object = get_taxonomy( $taxonomy ); 351 346 if ( $tax_object && in_array( 'bp_group', $tax_object->object_type, true ) ) { 352 return bp_groups_reset_cache_incrementor(); 353 } 354 355 return false; 347 bp_groups_reset_cache_incrementor(); 348 } 356 349 } 357 350 add_action( 'bp_set_object_terms', 'bp_groups_reset_cache_incrementor_on_group_term_change', 10, 4 ); … … 368 361 * @param array $terms Array of object terms. 369 362 * @param string $taxonomy Taxonomy slug. 370 * @return bool371 363 */ 372 364 function bp_groups_reset_cache_incrementor_on_group_term_remove( $object_id, $terms, $taxonomy ) { 373 365 $tax_object = get_taxonomy( $taxonomy ); 374 366 if ( $tax_object && in_array( 'bp_group', $tax_object->object_type, true ) ) { 375 return bp_groups_reset_cache_incrementor(); 376 } 377 378 return false; 367 bp_groups_reset_cache_incrementor(); 368 } 379 369 } 380 370 add_action( 'bp_remove_object_terms', 'bp_groups_reset_cache_incrementor_on_group_term_remove', 10, 3 ); 381 371 382 372 /* List actions to clear super cached pages on, if super cache is installed */ 383 add_action( 'groups_join_group', 384 add_action( 'groups_leave_group', 385 add_action( 'groups_accept_invite', 386 add_action( 'groups_reject_invite', 387 add_action( 'groups_invite_user', 388 add_action( 'groups_uninvite_user', 389 add_action( 'groups_details_updated', 390 add_action( 'groups_settings_updated', 391 add_action( 'groups_unban_member', 392 add_action( 'groups_ban_member', 393 add_action( 'groups_demote_member', 394 add_action( 'groups_promote_member', 395 add_action( 'groups_membership_rejected', 396 add_action( 'groups_membership_accepted', 397 add_action( 'groups_membership_requested', 373 add_action( 'groups_join_group', 'bp_core_clear_cache' ); 374 add_action( 'groups_leave_group', 'bp_core_clear_cache' ); 375 add_action( 'groups_accept_invite', 'bp_core_clear_cache' ); 376 add_action( 'groups_reject_invite', 'bp_core_clear_cache' ); 377 add_action( 'groups_invite_user', 'bp_core_clear_cache' ); 378 add_action( 'groups_uninvite_user', 'bp_core_clear_cache' ); 379 add_action( 'groups_details_updated', 'bp_core_clear_cache' ); 380 add_action( 'groups_settings_updated', 'bp_core_clear_cache' ); 381 add_action( 'groups_unban_member', 'bp_core_clear_cache' ); 382 add_action( 'groups_ban_member', 'bp_core_clear_cache' ); 383 add_action( 'groups_demote_member', 'bp_core_clear_cache' ); 384 add_action( 'groups_promote_member', 'bp_core_clear_cache' ); 385 add_action( 'groups_membership_rejected', 'bp_core_clear_cache' ); 386 add_action( 'groups_membership_accepted', 'bp_core_clear_cache' ); 387 add_action( 'groups_membership_requested', 'bp_core_clear_cache' ); 398 388 add_action( 'groups_create_group_step_complete', 'bp_core_clear_cache' ); 399 add_action( 'groups_created_group', 400 add_action( 'groups_group_avatar_updated', 389 add_action( 'groups_created_group', 'bp_core_clear_cache' ); 390 add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' ); -
trunk/src/bp-members/bp-members-cache.php
r13890 r13971 1 1 <?php 2 2 /** 3 * Caching functions specific to BuddyPress Members.3 * BuddyPress Members Caching. 4 4 * 5 5 * @package BuddyPress … … 21 21 $uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_member_type' ); 22 22 23 $member_types = bp_get_object_terms( $uncached_member_ids, bp_get_member_type_tax_name(), array( 24 'fields' => 'all_with_object_id', 25 ) ); 23 $member_types = bp_get_object_terms( 24 $uncached_member_ids, 25 bp_get_member_type_tax_name(), 26 array( 27 'fields' => 'all_with_object_id', 28 ) 29 ); 26 30 27 31 // Rekey by user ID. … … 67 71 * 68 72 * @since 2.7.0 69 *70 * @return bool71 73 */ 72 74 function bp_members_reset_activity_cache_incrementor() { 73 returnbp_core_reset_incrementor( 'bp_activity_with_last_activity' );75 bp_core_reset_incrementor( 'bp_activity_with_last_activity' ); 74 76 } 75 77 add_action( 'bp_core_user_updated_last_activity', 'bp_members_reset_activity_cache_incrementor' ); … … 85 87 wp_cache_delete( $signup_id, 'bp_signups' ); 86 88 } 87 add_action( 'bp_core_signups_after_add', 89 add_action( 'bp_core_signups_after_add', 'bp_members_delete_signup_cache' ); 88 90 add_action( 'bp_core_signups_after_update_meta', 'bp_members_delete_signup_cache' ); 89 91 … … 102 104 } 103 105 } 104 add_action( 'bp_core_signup_after_resend', 106 add_action( 'bp_core_signup_after_resend', 'bp_members_delete_signup_cache_multiples' ); 105 107 add_action( 'bp_core_signup_after_activate', 'bp_members_delete_signup_cache_multiples' ); 106 add_action( 'bp_core_signup_after_delete', 108 add_action( 'bp_core_signup_after_delete', 'bp_members_delete_signup_cache_multiples' ); 107 109 108 110 /** … … 115 117 * 116 118 * @since 10.0.0 117 *118 * @return bool119 119 */ 120 120 function bp_members_reset_signup_cache_incrementor() { 121 returnbp_core_reset_incrementor( 'bp_signups' );121 bp_core_reset_incrementor( 'bp_signups' ); 122 122 } 123 add_filter( 'bp_core_signups_after_add', 124 add_action( 'bp_core_activated_user', 125 add_action( 'bp_core_signup_after_activate', 123 add_filter( 'bp_core_signups_after_add', 'bp_members_reset_signup_cache_incrementor' ); 124 add_action( 'bp_core_activated_user', 'bp_members_reset_signup_cache_incrementor' ); 125 add_action( 'bp_core_signup_after_activate', 'bp_members_reset_signup_cache_incrementor' ); 126 126 add_action( 'bp_core_signups_after_update_meta', 'bp_members_reset_signup_cache_incrementor' ); 127 add_action( 'bp_core_signup_after_delete', 'bp_members_reset_signup_cache_incrementor' ); 128 127 add_action( 'bp_core_signup_after_delete', 'bp_members_reset_signup_cache_incrementor' ); -
trunk/src/bp-messages/bp-messages-cache.php
r13402 r13971 2 2 /** 3 3 * BuddyPress Messages Caching. 4 *5 * Caching functions handle the clearing of cached objects and pages on specific6 * actions throughout BuddyPress.7 4 * 8 5 * @package BuddyPress … … 27 24 */ 28 25 function bp_messages_update_meta_cache( $message_ids = false ) { 29 bp_update_meta_cache( array( 30 'object_ids' => $message_ids, 31 'object_type' => buddypress()->messages->id, 32 'cache_group' => 'message_meta', 33 'object_column' => 'message_id', 34 'meta_table' => buddypress()->messages->table_name_meta, 35 'cache_key_prefix' => 'bp_messages_meta' 36 ) ); 26 bp_update_meta_cache( 27 array( 28 'object_ids' => $message_ids, 29 'object_type' => buddypress()->messages->id, 30 'cache_group' => 'message_meta', 31 'object_column' => 'message_id', 32 'meta_table' => buddypress()->messages->table_name_meta, 33 'cache_key_prefix' => 'bp_messages_meta', 34 ) 35 ); 37 36 } 38 37 39 38 // List actions to clear super cached pages on, if super cache is installed. 40 add_action( 'messages_delete_thread', 41 add_action( 'messages_send_notice', 42 add_action( 'messages_message_sent', 39 add_action( 'messages_delete_thread', 'bp_core_clear_cache' ); 40 add_action( 'messages_send_notice', 'bp_core_clear_cache' ); 41 add_action( 'messages_message_sent', 'bp_core_clear_cache' ); 43 42 44 43 // Don't cache message inbox/sentbox/compose as it's too problematic. 45 44 add_action( 'messages_screen_compose', 'bp_core_clear_cache' ); 46 45 add_action( 'messages_screen_sentbox', 'bp_core_clear_cache' ); 47 add_action( 'messages_screen_inbox', 46 add_action( 'messages_screen_inbox', 'bp_core_clear_cache' ); 48 47 49 48 /** … … 105 104 * Invalidate cache for notices. 106 105 * 107 * Currently, invalidates active notice cache.108 *109 106 * @since 2.0.0 110 107 */ -
trunk/src/bp-notifications/bp-notifications-cache.php
r13247 r13971 1 1 <?php 2 2 /** 3 * Functions related to notifications caching.3 * BuddyPress Notifications Caching. 4 4 * 5 5 * @package BuddyPress … … 25 25 */ 26 26 function bp_notifications_update_meta_cache( $notification_ids = false ) { 27 bp_update_meta_cache( array( 28 'object_ids' => $notification_ids, 29 'object_type' => buddypress()->notifications->id, 30 'cache_group' => 'notification_meta', 31 'object_column' => 'notification_id', 32 'meta_table' => buddypress()->notifications->table_name_meta, 33 'cache_key_prefix' => 'bp_notifications_meta', 34 ) ); 27 bp_update_meta_cache( 28 array( 29 'object_ids' => $notification_ids, 30 'object_type' => buddypress()->notifications->id, 31 'cache_group' => 'notification_meta', 32 'object_column' => 'notification_id', 33 'meta_table' => buddypress()->notifications->table_name_meta, 34 'cache_key_prefix' => 'bp_notifications_meta', 35 ) 36 ); 35 37 } 36 38 … … 98 100 bp_notifications_clear_all_for_user_cache( $where_args['user_id'] ); 99 101 100 // Get user ID from Notification ID.102 // Get user ID from Notification ID. 101 103 } elseif ( ! empty( $where_args['id'] ) ) { 102 104 $n = bp_notifications_get_notification( $where_args['id'] ); … … 114 116 $ns = BP_Notifications_Notification::get( 115 117 array( 116 'id' 117 'is_new' 118 'id' => $ids, 119 'is_new' => $is_new, 118 120 ) 119 121 ); -
trunk/src/bp-xprofile/bp-xprofile-cache.php
r13491 r13971 2 2 /** 3 3 * BuddyPress XProfile Caching Functions. 4 *5 * Caching functions handle the clearing of cached objects and pages on specific6 * actions throughout BuddyPress.7 4 * 8 5 * @package BuddyPress … … 55 52 * @param array $object_ids Multi-dimensional array of object_ids, keyed by 56 53 * object type ('group', 'field', 'data'). 57 * @return bool58 54 */ 59 55 function bp_xprofile_update_meta_cache( $object_ids = array() ) { … … 62 58 // Bail if no objects. 63 59 if ( empty( $object_ids ) ) { 64 return false;60 return; 65 61 } 66 62 … … 132 128 133 129 // Setup the WHERE query part. 134 $where_sql = implode( " OR ", $where_conditions );130 $where_sql = implode( ' OR ', $where_conditions ); 135 131 136 132 // Attempt to query meta values. … … 186 182 */ 187 183 function xprofile_clear_profile_groups_object_cache( $group_obj ) { 188 wp_cache_delete( 'all', 184 wp_cache_delete( 'all', 'bp_xprofile_groups' ); 189 185 wp_cache_delete( $group_obj->id, 'bp_xprofile_groups' ); 190 186 } 191 187 add_action( 'xprofile_group_after_delete', 'xprofile_clear_profile_groups_object_cache' ); 192 add_action( 'xprofile_group_after_save', 188 add_action( 'xprofile_group_after_save', 'xprofile_clear_profile_groups_object_cache' ); 193 189 194 190 /** … … 207 203 // the group goes from empty to non-empty. Bust its cache, as well as 208 204 // the global 'all' cache. 209 wp_cache_delete( 'all', 205 wp_cache_delete( 'all', 'bp_xprofile_groups' ); 210 206 wp_cache_delete( $field_obj->group_id, 'bp_xprofile_groups' ); 211 207 } 212 add_action( 'xprofile_fields_saved_field', 208 add_action( 'xprofile_fields_saved_field', 'xprofile_clear_profile_field_object_cache' ); 213 209 add_action( 'xprofile_fields_deleted_field', 'xprofile_clear_profile_field_object_cache' ); 214 210 … … 233 229 wp_cache_delete( "{$data_obj->user_id}:{$data_obj->field_id}", 'bp_xprofile_data' ); 234 230 } 235 add_action( 'xprofile_data_after_save', 231 add_action( 'xprofile_data_after_save', 'xprofile_clear_profiledata_object_cache' ); 236 232 add_action( 'xprofile_data_after_delete', 'xprofile_clear_profiledata_object_cache' ); 237 233 … … 262 258 * 263 259 * @param int|BP_XProfile_Field $field A field ID or a field object. 264 * @return bool False on failure.265 260 */ 266 261 function bp_xprofile_clear_field_cache( $field ) { … … 272 267 273 268 if ( ! isset( $field_id ) ) { 274 return false;269 return; 275 270 } 276 271 … … 316 311 wp_cache_delete( $user_id, 'bp_user_mid' ); 317 312 } 318 add_action( 'profile_update', 'bp_xprofile_reset_user_mid_cache' , 10, 1);313 add_action( 'profile_update', 'bp_xprofile_reset_user_mid_cache' ); 319 314 320 315 /**
Note: See TracChangeset
for help on using the changeset viewer.