Making WordPress.org


Ignore:
Timestamp:
12/05/2022 08:52:35 AM (3 years ago)
Author:
dd32
Message:

WordPress.org Profiles: Don't share the BuddyPress Groups and Activity cache groups with BuddyPress.org.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/profiles.wordpress.org/public_html/wp-content/plugins/wporg-profiles-association-handler/wporg-profiles-association-handler.php

    r12127 r12298  
    2222            add_filter( 'bp_groups_meta_tables',   array( $this, 'change_meta_table_names' ) );
    2323            add_filter( 'bp_active_components',    array( $this, 'activate_groups_component' ) );
     24            add_action( 'bp_setup_cache_groups',   array( $this, 'bp_setup_cache_groups' ), 11 );
     25
    2426            add_action( 'plugins_loaded',          array( $this, 'plugins_loaded' ) );
    2527        }
     
    7072            return $tables;
    7173        }
     74
     75        /**
     76         * Make the cache-group localised to the profile site.
     77         *
     78         * See https://core.trac.wordpress.org/ticket/54303 for remove_global_group.
     79         */
     80        public function bp_setup_cache_groups() {
     81            global $wp_object_cache;
     82
     83            if ( ! is_object( $wp_object_cache ) || 'WPORG_Object_Cache' !== get_class( $wp_object_cache ) ) {
     84                return;
     85            }
     86
     87            $wp_object_cache->global_groups = array_diff(
     88                $wp_object_cache->global_groups,
     89                [
     90                    'bp_groups',
     91                    'bp_group_admins',
     92                    'bp_group_invite_count',
     93                    'group_meta',
     94                    'bp_groups_memberships',
     95                    'bp_groups_memberships_for_user',
     96                    'bp_group_mods',
     97                    'bp_groups_invitations_as_memberships',
     98                    'bp_groups_group_type'
     99                ]
     100            );
     101        }
     102
    72103
    73104        /**
Note: See TracChangeset for help on using the changeset viewer.