-
diff --git a/content/plugins/buddypress/bp-activity/bp-activity-admin.php b/content/plugins/buddypress/bp-activity/bp-activity-admin.php
index 74222e8..a59d98a 100644
|
a
|
b
|
|
| 506 | 506 | $result = $activity->save(); |
| 507 | 507 | |
| 508 | 508 | // Clear the activity stream first page cache, in case this activity's timestamp was changed |
| 509 | | wp_cache_delete( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 509 | wp_cache_delete( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 510 | 510 | |
| 511 | 511 | // Check for any error during activity save |
| 512 | 512 | if ( false === $result ) |
-
diff --git a/content/plugins/buddypress/bp-activity/bp-activity-functions.php b/content/plugins/buddypress/bp-activity/bp-activity-functions.php
index d3958f9..a5a1a44 100644
|
a
|
b
|
|
| 1043 | 1043 | // Attempt to return a cached copy of the first page of sitewide activity. |
| 1044 | 1044 | if ( ( 1 === (int) $r['page'] ) && empty( $r['max'] ) && empty( $r['search_terms'] ) && empty( $r['meta_query'] ) && empty( $r['date_query'] ) && empty( $r['filter'] ) && empty( $r['exclude'] ) && empty( $r['in'] ) && ( 'DESC' === $r['sort'] ) && empty( $r['exclude'] ) && ( 'ham_only' === $r['spam'] ) ) { |
| 1045 | 1045 | |
| 1046 | | $activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 1046 | $activity = wp_cache_get( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 1047 | 1047 | if ( false === $activity ) { |
| 1048 | 1048 | |
| 1049 | 1049 | $activity = BP_Activity_Activity::get( array( |
| … |
… |
|
| 1062 | 1062 | 'count_total' => $r['count_total'], |
| 1063 | 1063 | ) ); |
| 1064 | 1064 | |
| 1065 | | wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp_activity' ); |
| | 1065 | wp_cache_set( 'bp_activity_sitewide_front', $activity, bp_core_get_global_cache_key() ); |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | } else { |
| … |
… |
|
| 1232 | 1232 | BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id ); |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | | wp_cache_delete( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 1235 | wp_cache_delete( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 1236 | 1236 | do_action( 'bp_activity_add', $r ); |
| 1237 | 1237 | |
| 1238 | 1238 | return $activity->id; |
| … |
… |
|
| 1495 | 1495 | do_action( 'bp_activity_delete', $args ); |
| 1496 | 1496 | do_action( 'bp_activity_deleted_activities', $activity_ids_deleted ); |
| 1497 | 1497 | |
| 1498 | | wp_cache_delete( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 1498 | wp_cache_delete( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 1499 | 1499 | |
| 1500 | 1500 | return true; |
| 1501 | 1501 | } |
| … |
… |
|
| 1817 | 1817 | $activity->is_spam = 1; |
| 1818 | 1818 | |
| 1819 | 1819 | // Clear the activity stream first page cache |
| 1820 | | wp_cache_delete( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 1820 | wp_cache_delete( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 1821 | 1821 | |
| 1822 | 1822 | // Clear the activity comment cache for this activity item |
| 1823 | 1823 | wp_cache_delete( $activity->id, 'bp_activity_comments' ); |
| … |
… |
|
| 1855 | 1855 | $activity->is_spam = 0; |
| 1856 | 1856 | |
| 1857 | 1857 | // Clear the activity stream first page cache |
| 1858 | | wp_cache_delete( 'bp_activity_sitewide_front', 'bp_activity' ); |
| | 1858 | wp_cache_delete( 'bp_activity_sitewide_front', bp_core_get_global_cache_key() ); |
| 1859 | 1859 | |
| 1860 | 1860 | // Clear the activity comment cache for this activity item |
| 1861 | 1861 | wp_cache_delete( $activity->id, 'bp_activity_comments' ); |
-
diff --git a/content/plugins/buddypress/bp-blogs/bp-blogs-cache.php b/content/plugins/buddypress/bp-blogs/bp-blogs-cache.php
index c16fba9..bddfb72 100644
|
a
|
b
|
|
| 43 | 43 | * @param int $user_id ID of the user whose blog cache should be cleared. |
| 44 | 44 | */ |
| 45 | 45 | function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) { |
| 46 | | wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' ); |
| 47 | | wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' ); |
| | 46 | wp_cache_delete( 'bp_blogs_of_user_' . $user_id, bp_core_get_global_cache_key() ); |
| | 47 | wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, bp_core_get_global_cache_key() ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| … |
… |
|
| 57 | 57 | */ |
| 58 | 58 | function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) { |
| 59 | 59 | bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id ); |
| 60 | | wp_cache_delete( 'bp_total_blogs', 'bp' ); |
| | 60 | wp_cache_delete( 'bp_total_blogs', bp_core_get_global_cache_key() ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // List actions to clear object caches on |
-
diff --git a/content/plugins/buddypress/bp-blogs/bp-blogs-functions.php b/content/plugins/buddypress/bp-blogs/bp-blogs-functions.php
index ea472ad..d48b2e5 100644
|
a
|
b
|
|
| 1208 | 1208 | * @return int $count Total blog count. |
| 1209 | 1209 | */ |
| 1210 | 1210 | function bp_blogs_total_blogs() { |
| 1211 | | if ( !$count = wp_cache_get( 'bp_total_blogs', 'bp' ) ) { |
| | 1211 | if ( !$count = wp_cache_get( 'bp_total_blogs', bp_core_get_global_cache_key() ) ) { |
| 1212 | 1212 | $blogs = BP_Blogs_Blog::get_all(); |
| 1213 | 1213 | $count = $blogs['total']; |
| 1214 | | wp_cache_set( 'bp_total_blogs', $count, 'bp' ); |
| | 1214 | wp_cache_set( 'bp_total_blogs', $count, bp_core_get_global_cache_key() ); |
| 1215 | 1215 | } |
| 1216 | 1216 | return $count; |
| 1217 | 1217 | } |
| … |
… |
|
| 1235 | 1235 | return 0; |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | | $count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ); |
| | 1238 | $count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, bp_core_get_global_cache_key() ); |
| 1239 | 1239 | if ( false === $count ) { |
| 1240 | 1240 | $count = BP_Blogs_Blog::total_blog_count_for_user( $user_id ); |
| 1241 | | wp_cache_set( 'bp_total_blogs_for_user_' . $user_id, $count, 'bp' ); |
| | 1241 | wp_cache_set( 'bp_total_blogs_for_user_' . $user_id, $count, bp_core_get_global_cache_key() ); |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | return $count; |
-
diff --git a/content/plugins/buddypress/bp-core/bp-core-cache.php b/content/plugins/buddypress/bp-core/bp-core-cache.php
index 340bbb2..02d566c 100644
|
a
|
b
|
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | | * Add 'bp' to global group of network wide cachable objects. |
| | 30 | * Return global cache key filtered with `bp_core_get_global_cache_key` |
| | 31 | * |
| | 32 | * The filter is intended primarily for use in multiblog mode and multinetwork |
| | 33 | * installations. |
| | 34 | * |
| | 35 | * @return string Filtered global cache key. |
| | 36 | */ |
| | 37 | function bp_core_get_global_cache_key() { |
| | 38 | return apply_filters( 'bp_core_get_global_cache_key', 'bp' ); |
| | 39 | } |
| | 40 | |
| | 41 | /** |
| | 42 | * Return array of global cache groups, filtered with `bp_core_get_global_cache_groups` |
| | 43 | * |
| | 44 | * The filter is intended primarily for use in multiblog mode and multinetwork |
| | 45 | * installations. |
| | 46 | * |
| | 47 | * @return array |
| | 48 | */ |
| | 49 | function bp_core_get_global_cache_groups() { |
| | 50 | return apply_filters( 'bp_core_get_global_cache_groups', array( bp_core_get_global_cache_key() ) ); |
| | 51 | } |
| | 52 | |
| | 53 | /** |
| | 54 | * Add global cache group of network wide cachable objects. |
| 31 | 55 | */ |
| 32 | 56 | function bp_core_add_global_group() { |
| 33 | 57 | if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
| 34 | | wp_cache_add_global_groups( array( 'bp' ) ); |
| | 58 | wp_cache_add_global_groups( bp_core_get_global_cache_groups() ); |
| 35 | 59 | } |
| 36 | 60 | } |
| 37 | 61 | add_action( 'bp_loaded', 'bp_core_add_global_group' ); |
| … |
… |
|
| 40 | 64 | * Clear all cached objects for a user, or those that a user is part of. |
| 41 | 65 | */ |
| 42 | 66 | function bp_core_clear_user_object_cache( $user_id ) { |
| 43 | | wp_cache_delete( 'bp_user_' . $user_id, 'bp' ); |
| | 67 | wp_cache_delete( 'bp_user_' . $user_id, bp_core_get_global_cache_key() ); |
| 44 | 68 | } |
| 45 | 69 | |
| 46 | 70 | /** |
| 47 | 71 | * Clear member count caches and transients. |
| 48 | 72 | */ |
| 49 | 73 | function bp_core_clear_member_count_caches() { |
| 50 | | wp_cache_delete( 'bp_total_member_count', 'bp' ); |
| | 74 | wp_cache_delete( 'bp_total_member_count', bp_core_get_global_cache_key() ); |
| 51 | 75 | delete_transient( 'bp_active_member_count' ); |
| 52 | 76 | } |
| 53 | 77 | add_action( 'bp_core_activated_user', 'bp_core_clear_member_count_caches' ); |
| … |
… |
|
| 79 | 103 | return; |
| 80 | 104 | } |
| 81 | 105 | |
| 82 | | wp_cache_delete( 'directory_pages', 'bp' ); |
| | 106 | wp_cache_delete( 'directory_pages', bp_core_get_global_cache_key() ); |
| 83 | 107 | } |
| 84 | 108 | add_action( 'save_post', 'bp_core_clear_directory_pages_cache_page_edit' ); |
| 85 | 109 | |
| … |
… |
|
| 92 | 116 | */ |
| 93 | 117 | function bp_core_clear_directory_pages_cache_settings_edit( $option ) { |
| 94 | 118 | if ( 'bp-pages' === $option ) { |
| 95 | | wp_cache_delete( 'directory_pages', 'bp' ); |
| | 119 | wp_cache_delete( 'directory_pages', bp_core_get_global_cache_key() ); |
| 96 | 120 | } |
| 97 | 121 | } |
| 98 | 122 | add_action( 'update_option', 'bp_core_clear_directory_pages_cache_settings_edit' ); |
| … |
… |
|
| 116 | 140 | ) ); |
| 117 | 141 | |
| 118 | 142 | if ( in_array( $option, $keys ) ) { |
| 119 | | wp_cache_delete( 'root_blog_options', 'bp' ); |
| | 143 | wp_cache_delete( 'root_blog_options', bp_core_get_global_cache_key() ); |
| 120 | 144 | } |
| 121 | 145 | } |
| 122 | 146 | add_action( 'update_option', 'bp_core_clear_root_options_cache' ); |
-
diff --git a/content/plugins/buddypress/bp-core/bp-core-classes.php b/content/plugins/buddypress/bp-core/bp-core-classes.php
index 8977494..bdc2bb6 100644
|
a
|
b
|
|
| 486 | 486 | // only uncached users. However, BP does cache this data, so |
| 487 | 487 | // we set it here. |
| 488 | 488 | foreach ( $wp_user_query->results as $u ) { |
| 489 | | wp_cache_set( 'bp_core_userdata_' . $u->ID, $u, 'bp' ); |
| | 489 | wp_cache_set( 'bp_core_userdata_' . $u->ID, $u, bp_core_get_global_cache_key() ); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | // We calculate total_users using a standalone query, except |
| … |
… |
|
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | // Cache a few things that are fetched often |
| 831 | | wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' ); |
| 832 | | wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' ); |
| 833 | | wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' ); |
| | 831 | wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, bp_core_get_global_cache_key() ); |
| | 832 | wp_cache_set( 'bp_user_email_' . $this->id, $this->email, bp_core_get_global_cache_key() ); |
| | 833 | wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, bp_core_get_global_cache_key() ); |
| 834 | 834 | |
| 835 | 835 | $this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full', 'alt' => sprintf( __( 'Profile photo of %s', 'buddypress' ), $this->fullname ) ) ); |
| 836 | 836 | $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile photo of %s', 'buddypress' ), $this->fullname ) ) ); |
-
diff --git a/content/plugins/buddypress/bp-core/bp-core-functions.php b/content/plugins/buddypress/bp-core/bp-core-functions.php
index 5b93f9c..8d5a96e 100644
|
a
|
b
|
|
| 416 | 416 | global $wpdb; |
| 417 | 417 | |
| 418 | 418 | // Look in cache first |
| 419 | | $pages = wp_cache_get( 'directory_pages', 'bp' ); |
| | 419 | $pages = wp_cache_get( 'directory_pages', bp_core_get_global_cache_key() ); |
| 420 | 420 | |
| 421 | 421 | if ( false === $pages ) { |
| 422 | 422 | |
| … |
… |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | | wp_cache_set( 'directory_pages', $pages, 'bp' ); |
| | 463 | wp_cache_set( 'directory_pages', $pages, bp_core_get_global_cache_key() ); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | return apply_filters( 'bp_core_get_directory_pages', $pages ); |
-
diff --git a/content/plugins/buddypress/bp-core/bp-core-options.php b/content/plugins/buddypress/bp-core/bp-core-options.php
index f927069..de12b6d 100644
|
a
|
b
|
|
| 343 | 343 | // Check cache first - We cache here instead of using the standard WP |
| 344 | 344 | // settings cache because the current blog may not be the root blog, |
| 345 | 345 | // and it's not practical to access the cache across blogs |
| 346 | | $root_blog_options_meta = wp_cache_get( 'root_blog_options', 'bp' ); |
| | 346 | $root_blog_options_meta = wp_cache_get( 'root_blog_options', bp_core_get_global_cache_key() ); |
| 347 | 347 | |
| 348 | 348 | if ( false === $root_blog_options_meta ) { |
| 349 | 349 | $blog_options_keys = "'" . join( "', '", (array) $root_blog_option_keys ) . "'"; |
| … |
… |
|
| 426 | 426 | unset( $root_blog_options ); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | | wp_cache_set( 'root_blog_options', $root_blog_options_meta, 'bp' ); |
| | 429 | wp_cache_set( 'root_blog_options', $root_blog_options_meta, bp_core_get_global_cache_key() ); |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | return apply_filters( 'bp_core_get_root_options', $root_blog_options_meta ); |
-
diff --git a/content/plugins/buddypress/bp-core/deprecated/2.1.php b/content/plugins/buddypress/bp-core/deprecated/2.1.php
index 9ad16e9..d6512cb 100644
|
a
|
b
|
|
| 104 | 104 | if ( !is_multisite() ) |
| 105 | 105 | return false; |
| 106 | 106 | |
| 107 | | $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' ); |
| | 107 | $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', bp_core_get_global_cache_key() ); |
| 108 | 108 | if ( empty( $blogs ) ) { |
| 109 | 109 | $blogs = bp_blogs_get_blogs_for_user( bp_loggedin_user_id(), true ); |
| 110 | | wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp' ); |
| | 110 | wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, bp_core_get_global_cache_key() ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $counter = 0; |
-
diff --git a/content/plugins/buddypress/bp-friends/bp-friends-cache.php b/content/plugins/buddypress/bp-friends/bp-friends-cache.php
index 417525c..a733cf9 100644
|
a
|
b
|
|
| 23 | 23 | if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) ) |
| 24 | 24 | return false; |
| 25 | 25 | |
| 26 | | wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' ); |
| 27 | | wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' ); |
| | 26 | wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, bp_core_get_global_cache_key() ); |
| | 27 | wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, bp_core_get_global_cache_key() ); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // List actions to clear object caches on |
-
diff --git a/content/plugins/buddypress/bp-friends/bp-friends-template.php b/content/plugins/buddypress/bp-friends/bp-friends-template.php
index d9ffa8d..cf0b362 100644
|
a
|
b
|
|
| 57 | 57 | */ |
| 58 | 58 | function bp_friends_random_friends() { |
| 59 | 59 | |
| 60 | | if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) { |
| | 60 | if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), bp_core_get_global_cache_key() ) ) { |
| 61 | 61 | $friend_ids = BP_Friends_Friendship::get_random_friends( bp_displayed_user_id() ); |
| 62 | | wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp' ); |
| | 62 | wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, bp_core_get_global_cache_key() ); |
| 63 | 63 | } ?> |
| 64 | 64 | |
| 65 | 65 | <div class="info-group"> |
| … |
… |
|
| 105 | 105 | */ |
| 106 | 106 | function bp_friends_random_members( $total_members = 5 ) { |
| 107 | 107 | |
| 108 | | if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) { |
| | 108 | if ( !$user_ids = wp_cache_get( 'friends_random_users', bp_core_get_global_cache_key() ) ) { |
| 109 | 109 | $user_ids = BP_Core_User::get_users( 'random', $total_members ); |
| 110 | | wp_cache_set( 'friends_random_users', $user_ids, 'bp' ); |
| | 110 | wp_cache_set( 'friends_random_users', $user_ids, bp_core_get_global_cache_key() ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | ?> |
| … |
… |
|
| 441 | 441 | |
| 442 | 442 | if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { |
| 443 | 443 | $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() ); |
| 444 | | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' ); |
| | 444 | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, bp_core_get_global_cache_key() ); |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | return apply_filters( 'bp_get_friend_friendship_id', $friendship_id ); |
| … |
… |
|
| 463 | 463 | |
| 464 | 464 | if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { |
| 465 | 465 | $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() ); |
| 466 | | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' ); |
| | 466 | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, bp_core_get_global_cache_key() ); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id, 'friends_accept_friendship' ) ); |
| … |
… |
|
| 485 | 485 | |
| 486 | 486 | if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { |
| 487 | 487 | $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() ); |
| 488 | | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' ); |
| | 488 | wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, bp_core_get_global_cache_key() ); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/reject/' . $friendship_id, 'friends_reject_friendship' ) ); |
-
diff --git a/content/plugins/buddypress/bp-groups/bp-groups-cache.php b/content/plugins/buddypress/bp-groups/bp-groups-cache.php
index 498cbee..3085644 100644
|
a
|
b
|
|
| 48 | 48 | * @param $group_id Not used. |
| 49 | 49 | */ |
| 50 | 50 | function groups_clear_group_object_cache( $group_id ) { |
| 51 | | wp_cache_delete( 'bp_total_group_count', 'bp' ); |
| | 51 | wp_cache_delete( 'bp_total_group_count', bp_core_get_global_cache_key() ); |
| 52 | 52 | } |
| 53 | 53 | add_action( 'groups_group_deleted', 'groups_clear_group_object_cache' ); |
| 54 | 54 | add_action( 'groups_settings_updated', 'groups_clear_group_object_cache' ); |
| … |
… |
|
| 164 | 164 | * @param int $user_id The user ID. |
| 165 | 165 | */ |
| 166 | 166 | function groups_clear_group_user_object_cache( $group_id, $user_id ) { |
| 167 | | wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' ); |
| | 167 | wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, bp_core_get_global_cache_key() ); |
| 168 | 168 | } |
| 169 | 169 | add_action( 'groups_join_group', 'groups_clear_group_user_object_cache', 10, 2 ); |
| 170 | 170 | add_action( 'groups_leave_group', 'groups_clear_group_user_object_cache', 10, 2 ); |
-
diff --git a/content/plugins/buddypress/bp-groups/bp-groups-functions.php b/content/plugins/buddypress/bp-groups/bp-groups-functions.php
index c83e743..a4a8f2f 100644
|
a
|
b
|
|
| 629 | 629 | * @return int |
| 630 | 630 | */ |
| 631 | 631 | function groups_get_total_group_count() { |
| 632 | | if ( !$count = wp_cache_get( 'bp_total_group_count', 'bp' ) ) { |
| | 632 | if ( !$count = wp_cache_get( 'bp_total_group_count', bp_core_get_global_cache_key() ) ) { |
| 633 | 633 | $count = BP_Groups_Group::get_total_group_count(); |
| 634 | | wp_cache_set( 'bp_total_group_count', $count, 'bp' ); |
| | 634 | wp_cache_set( 'bp_total_group_count', $count, bp_core_get_global_cache_key() ); |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | return $count; |
| … |
… |
|
| 669 | 669 | if ( empty( $user_id ) ) |
| 670 | 670 | $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); |
| 671 | 671 | |
| 672 | | if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) { |
| | 672 | if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, bp_core_get_global_cache_key() ) ) { |
| 673 | 673 | $count = BP_Groups_Member::total_group_count( $user_id ); |
| 674 | | wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' ); |
| | 674 | wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, bp_core_get_global_cache_key() ); |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | return $count; |
-
diff --git a/content/plugins/buddypress/bp-members/bp-members-functions.php b/content/plugins/buddypress/bp-members/bp-members-functions.php
index 6a6de27..431d631 100644
|
a
|
b
|
|
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | | if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, 'bp' ) ) { |
| | 185 | if ( !$userdata = wp_cache_get( 'bp_core_userdata_' . $user_id, bp_core_get_global_cache_key() ) ) { |
| 186 | 186 | $userdata = BP_Core_User::get_core_userdata( $user_id ); |
| 187 | | wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' ); |
| | 187 | wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, bp_core_get_global_cache_key() ); |
| 188 | 188 | } |
| 189 | 189 | return apply_filters( 'bp_core_get_core_userdata', $userdata ); |
| 190 | 190 | } |
| … |
… |
|
| 254 | 254 | $bp = buddypress(); |
| 255 | 255 | |
| 256 | 256 | // Check cache for user nicename |
| 257 | | $username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ); |
| | 257 | $username = wp_cache_get( 'bp_user_username_' . $user_id, bp_core_get_global_cache_key() ); |
| 258 | 258 | if ( false === $username ) { |
| 259 | 259 | |
| 260 | 260 | // Cache not found so prepare to update it |
| … |
… |
|
| 303 | 303 | |
| 304 | 304 | // Add this to cache |
| 305 | 305 | if ( ( true === $update_cache ) && !empty( $username ) ) { |
| 306 | | wp_cache_set( 'bp_user_username_' . $user_id, $username, 'bp' ); |
| | 306 | wp_cache_set( 'bp_user_username_' . $user_id, $username, bp_core_get_global_cache_key() ); |
| 307 | 307 | |
| 308 | 308 | // @todo bust this cache if no $username found? |
| 309 | 309 | //} else { |
| … |
… |
|
| 329 | 329 | function bp_members_get_user_nicename( $user_id ) { |
| 330 | 330 | $bp = buddypress(); |
| 331 | 331 | |
| 332 | | if ( !$user_nicename = wp_cache_get( 'bp_members_user_nicename_' . $user_id, 'bp' ) ) { |
| | 332 | if ( !$user_nicename = wp_cache_get( 'bp_members_user_nicename_' . $user_id, bp_core_get_global_cache_key() ) ) { |
| 333 | 333 | $update_cache = true; |
| 334 | 334 | |
| 335 | 335 | // User ID matches logged in user |
| … |
… |
|
| 364 | 364 | |
| 365 | 365 | // Add this to cache |
| 366 | 366 | if ( true == $update_cache && !empty( $user_nicename ) ) { |
| 367 | | wp_cache_set( 'bp_members_user_nicename_' . $user_id, $user_nicename, 'bp' ); |
| | 367 | wp_cache_set( 'bp_members_user_nicename_' . $user_id, $user_nicename, bp_core_get_global_cache_key() ); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | return apply_filters( 'bp_members_get_user_nicename', $user_nicename ); |
| … |
… |
|
| 379 | 379 | */ |
| 380 | 380 | function bp_core_get_user_email( $uid ) { |
| 381 | 381 | |
| 382 | | if ( !$email = wp_cache_get( 'bp_user_email_' . $uid, 'bp' ) ) { |
| | 382 | if ( !$email = wp_cache_get( 'bp_user_email_' . $uid, bp_core_get_global_cache_key() ) ) { |
| 383 | 383 | |
| 384 | 384 | // User exists |
| 385 | 385 | $ud = bp_core_get_core_userdata( $uid ); |
| … |
… |
|
| 391 | 391 | $email = ''; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | | wp_cache_set( 'bp_user_email_' . $uid, $email, 'bp' ); |
| | 394 | wp_cache_set( 'bp_user_email_' . $uid, $email, bp_core_get_global_cache_key() ); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | return apply_filters( 'bp_core_get_user_email', $email ); |
| … |
… |
|
| 458 | 458 | |
| 459 | 459 | $uncached_ids = array(); |
| 460 | 460 | foreach ( $user_ids as $user_id ) { |
| 461 | | if ( false === wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) { |
| | 461 | if ( false === wp_cache_get( 'bp_user_fullname_' . $user_id, bp_core_get_global_cache_key() ) ) { |
| 462 | 462 | $uncached_ids[] = $user_id; |
| 463 | 463 | } |
| 464 | 464 | } |
| … |
… |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | foreach ( $fullnames as $fuser_id => $fname ) { |
| 508 | | wp_cache_set( 'bp_user_fullname_' . $fuser_id, $fname, 'bp' ); |
| | 508 | wp_cache_set( 'bp_user_fullname_' . $fuser_id, $fname, bp_core_get_global_cache_key() ); |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | $retval = array(); |
| 513 | 513 | foreach ( $user_ids as $user_id ) { |
| 514 | | $retval[ $user_id ] = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ); |
| | 514 | $retval[ $user_id ] = wp_cache_get( 'bp_user_fullname_' . $user_id, bp_core_get_global_cache_key() ); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | return $retval; |
| … |
… |
|
| 597 | 597 | function bp_core_get_total_member_count() { |
| 598 | 598 | global $wpdb; |
| 599 | 599 | |
| 600 | | if ( !$count = wp_cache_get( 'bp_total_member_count', 'bp' ) ) { |
| | 600 | if ( !$count = wp_cache_get( 'bp_total_member_count', bp_core_get_global_cache_key() ) ) { |
| 601 | 601 | $status_sql = bp_core_get_status_sql(); |
| 602 | 602 | $count = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users} WHERE {$status_sql}" ); |
| 603 | | wp_cache_set( 'bp_total_member_count', $count, 'bp' ); |
| | 603 | wp_cache_set( 'bp_total_member_count', $count, bp_core_get_global_cache_key() ); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | return apply_filters( 'bp_core_get_total_member_count', $count ); |
-
diff --git a/content/plugins/buddypress/bp-settings/bp-settings-actions.php b/content/plugins/buddypress/bp-settings/bp-settings-actions.php
index cc99f7e..049f2fc 100644
|
a
|
b
|
|
| 196 | 196 | // Clear cached data, so that the changed settings take effect |
| 197 | 197 | // on the current page load |
| 198 | 198 | if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) { |
| 199 | | wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' ); |
| | 199 | wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), bp_core_get_global_cache_key() ); |
| 200 | 200 | $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); |
| 201 | 201 | } |
| 202 | 202 | |
-
diff --git a/content/plugins/buddypress/bp-xprofile/bp-xprofile-cache.php b/content/plugins/buddypress/bp-xprofile/bp-xprofile-cache.php
index 0ad4103..5155a57 100644
|
a
|
b
|
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | function xprofile_clear_profile_groups_object_cache( $group_obj ) { |
| 124 | | wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' ); |
| 125 | | wp_cache_delete( 'xprofile_group_' . $group_obj->id, 'bp' ); |
| | 124 | wp_cache_delete( 'xprofile_groups_inc_empty', bp_core_get_global_cache_key() ); |
| | 125 | wp_cache_delete( 'xprofile_group_' . $group_obj->id, bp_core_get_global_cache_key() ); |
| 126 | 126 | } |
| 127 | 127 | add_action( 'xprofile_group_after_delete', 'xprofile_clear_profile_groups_object_cache' ); |
| 128 | 128 | add_action( 'xprofile_group_after_save', 'xprofile_clear_profile_groups_object_cache' ); |
| 129 | 129 | |
| 130 | 130 | function xprofile_clear_profile_data_object_cache( $group_id ) { |
| 131 | | wp_cache_delete( 'bp_user_fullname_' . bp_loggedin_user_id(), 'bp' ); |
| | 131 | wp_cache_delete( 'bp_user_fullname_' . bp_loggedin_user_id(), bp_core_get_global_cache_key() ); |
| 132 | 132 | } |
| 133 | 133 | add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache' ); |
| 134 | 134 | |
| … |
… |
|
| 142 | 142 | */ |
| 143 | 143 | function xprofile_clear_fullname_cache_on_profile_field_edit( $data ) { |
| 144 | 144 | if ( 1 == $data->field_id ) { |
| 145 | | wp_cache_delete( 'bp_user_fullname_' . $data->user_id, 'bp' ); |
| | 145 | wp_cache_delete( 'bp_user_fullname_' . $data->user_id, bp_core_get_global_cache_key() ); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | add_action( 'xprofile_data_after_save', 'xprofile_clear_fullname_cache_on_profile_field_edit' ); |
| … |
… |
|
| 156 | 156 | */ |
| 157 | 157 | function xprofile_clear_profile_field_object_cache( $field_obj ) { |
| 158 | 158 | // Clear default visibility level cache |
| 159 | | wp_cache_delete( 'xprofile_default_visibility_levels', 'bp' ); |
| | 159 | wp_cache_delete( 'xprofile_default_visibility_levels', bp_core_get_global_cache_key() ); |
| 160 | 160 | |
| 161 | 161 | // Modified fields can alter parent group status, in particular when |
| 162 | 162 | // the group goes from empty to non-empty. Bust its cache, as well as |
| 163 | 163 | // the global group_inc_empty cache |
| 164 | | wp_cache_delete( 'xprofile_group_' . $field_obj->group_id, 'bp' ); |
| 165 | | wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' ); |
| | 164 | wp_cache_delete( 'xprofile_group_' . $field_obj->group_id, bp_core_get_global_cache_key() ); |
| | 165 | wp_cache_delete( 'xprofile_groups_inc_empty', bp_core_get_global_cache_key() ); |
| 166 | 166 | } |
| 167 | 167 | add_action( 'xprofile_fields_saved_field', 'xprofile_clear_profile_field_object_cache' ); |
| 168 | 168 | add_action( 'xprofile_fields_deleted_field', 'xprofile_clear_profile_field_object_cache' ); |
-
diff --git a/content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php b/content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php
index 5fb8e50..0932cf2 100644
|
a
|
b
|
|
| 26 | 26 | public function populate( $id ) { |
| 27 | 27 | global $wpdb, $bp; |
| 28 | 28 | |
| 29 | | $group = wp_cache_get( 'xprofile_group_' . $this->id, 'bp' ); |
| | 29 | $group = wp_cache_get( 'xprofile_group_' . $this->id, bp_core_get_global_cache_key() ); |
| 30 | 30 | |
| 31 | 31 | if ( false === $group ) { |
| 32 | 32 | $group = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_groups} WHERE id = %d", $id ) ); |
| … |
… |
|
| 337 | 337 | foreach ( $group_ids as $group_id ) { |
| 338 | 338 | |
| 339 | 339 | // If cached data is found, use it |
| 340 | | if ( $group_data = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { |
| | 340 | if ( $group_data = wp_cache_get( 'xprofile_group_' . $group_id, bp_core_get_global_cache_key() ) ) { |
| 341 | 341 | $groups[ $group_id ] = $group_data; |
| 342 | 342 | |
| 343 | 343 | // Otherwise leave a placeholder so we don't lose the order |
| … |
… |
|
| 362 | 362 | // and add it to the cache |
| 363 | 363 | foreach ( (array) $queried_gdata as $gdata ) { |
| 364 | 364 | $groups[ $gdata->id ] = $gdata; |
| 365 | | wp_cache_set( 'xprofile_group_' . $gdata->id, $gdata, 'bp' ); |
| | 365 | wp_cache_set( 'xprofile_group_' . $gdata->id, $gdata, bp_core_get_global_cache_key() ); |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| … |
… |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | // purge profile field group cache |
| 395 | | wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' ); |
| | 395 | wp_cache_delete( 'xprofile_groups_inc_empty', bp_core_get_global_cache_key() ); |
| 396 | 396 | |
| 397 | 397 | return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET group_order = %d WHERE id = %d", $position, $field_group_id ) ); |
| 398 | 398 | } |
| … |
… |
|
| 444 | 444 | public static function fetch_default_visibility_levels() { |
| 445 | 445 | global $wpdb, $bp; |
| 446 | 446 | |
| 447 | | $default_visibility_levels = wp_cache_get( 'xprofile_default_visibility_levels', 'bp' ); |
| | 447 | $default_visibility_levels = wp_cache_get( 'xprofile_default_visibility_levels', bp_core_get_global_cache_key() ); |
| 448 | 448 | |
| 449 | 449 | if ( false === $default_visibility_levels ) { |
| 450 | 450 | $levels = $wpdb->get_results( "SELECT object_id, meta_key, meta_value FROM {$bp->profile->table_name_meta} WHERE object_type = 'field' AND ( meta_key = 'default_visibility' OR meta_key = 'allow_custom_visibility' )" ); |
| … |
… |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | | wp_cache_set( 'xprofile_default_visibility_levels', $default_visibility_levels, 'bp' ); |
| | 462 | wp_cache_set( 'xprofile_default_visibility_levels', $default_visibility_levels, bp_core_get_global_cache_key() ); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $default_visibility_levels; |
-
diff --git a/content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php b/content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php
index 5c9e53f..c93d97e 100644
|
a
|
b
|
|
| 627 | 627 | * @return object $groups |
| 628 | 628 | */ |
| 629 | 629 | function bp_profile_get_field_groups() { |
| 630 | | $groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ); |
| | 630 | $groups = wp_cache_get( 'xprofile_groups_inc_empty', bp_core_get_global_cache_key() ); |
| 631 | 631 | |
| 632 | 632 | if ( empty( $groups ) ) { |
| 633 | 633 | $groups = bp_xprofile_get_groups( array( 'fetch_fields' => true ) ); |
| 634 | | wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' ); |
| | 634 | wp_cache_set( 'xprofile_groups_inc_empty', $groups, bp_core_get_global_cache_key() ); |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | return apply_filters( 'bp_profile_get_field_groups', $groups ); |
| … |
… |
|
| 696 | 696 | if ( !is_numeric( $group_id ) ) |
| 697 | 697 | $group_id = 1; |
| 698 | 698 | |
| 699 | | if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { |
| | 699 | if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, bp_core_get_global_cache_key() ) ) { |
| 700 | 700 | $group = new BP_XProfile_Group($group_id); |
| 701 | | wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' ); |
| | 701 | wp_cache_set( 'xprofile_group_' . $group_id, $group, bp_core_get_global_cache_key() ); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | return apply_filters( 'bp_get_profile_group_name', $group->name ); |