Making WordPress.org

Changeset 12298


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.

Location:
sites/trunk/profiles.wordpress.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

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

    r12016 r12298  
    3939            add_filter( 'bp_activity_meta_tables',   array( $this, 'change_meta_table_names' ) );
    4040            add_filter( 'bp_active_components',      array( $this, 'activate_activity_component' ) );
     41            add_action( 'bp_setup_cache_groups',     array( $this, 'bp_setup_cache_groups' ), 11 );
    4142            add_action( 'plugins_loaded',            array( $this, 'plugins_loaded' ) );
    4243
     
    4546            add_filter( 'bp_activity_do_mentions', '__return_false' );
    4647            add_filter( 'bp_activity_use_akismet', '__return_false' );
     48
    4749        }
    4850
     
    106108
    107109            return $tables;
     110        }
     111
     112        /**
     113         * Make the cache-group localised to the profile site.
     114         *
     115         * See https://core.trac.wordpress.org/ticket/54303 for remove_global_group.
     116         */
     117        public function bp_setup_cache_groups() {
     118            global $wp_object_cache;
     119
     120            if ( ! is_object( $wp_object_cache ) || 'WPORG_Object_Cache' !== get_class( $wp_object_cache ) ) {
     121                return;
     122            }
     123
     124            $wp_object_cache->global_groups = array_diff(
     125                $wp_object_cache->global_groups,
     126                [
     127                    'bp_activity',
     128                    'bp_activity_comments',
     129                    'activity_meta'
     130                ]
     131            );
    108132        }
    109133
  • 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.