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-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
Note: See TracChangeset for help on using the changeset viewer.