Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/04/2024 02:32:30 AM (8 months ago)
Author:
espellcaste
Message:

WPCS: Part XI: miscellaneous fixes for some of the files of the core component.

Follow-up to [13903]

See #9164 and #7228

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-cache.php

    r13890 r13904  
    6565    delete_transient( 'bp_active_member_count' );
    6666}
    67 add_action( 'bp_core_activated_user',         'bp_core_clear_member_count_caches' );
     67add_action( 'bp_core_activated_user', 'bp_core_clear_member_count_caches' );
    6868add_action( 'bp_core_process_spammer_status', 'bp_core_clear_member_count_caches' );
    69 add_action( 'bp_core_deleted_account',        'bp_core_clear_member_count_caches' );
    70 add_action( 'bp_first_activity_for_member',   'bp_core_clear_member_count_caches' );
    71 add_action( 'deleted_user',                   'bp_core_clear_member_count_caches' );
     69add_action( 'bp_core_deleted_account', 'bp_core_clear_member_count_caches' );
     70add_action( 'bp_first_activity_for_member', 'bp_core_clear_member_count_caches' );
     71add_action( 'deleted_user', 'bp_core_clear_member_count_caches' );
    7272
    7373/**
     
    9393
    9494    // Bail if post ID is not a directory page.
    95     if ( ! in_array( $post_id, $page_ids ) ) {
     95    if ( ! in_array( $post_id, $page_ids, true ) ) {
    9696        return;
    9797    }
     
    134134    }
    135135
    136     $keys = array_merge( $keys, array(
    137         'registration',
    138         'avatar_default',
    139         'tags_blog_id',
    140         'sitewide_tags_blog',
    141         'registration',
    142         'fileupload_mask',
    143     ) );
    144 
    145     if ( in_array( $option, $keys ) ) {
     136    $keys = array_merge(
     137        $keys,
     138        array(
     139            'registration',
     140            'avatar_default',
     141            'tags_blog_id',
     142            'sitewide_tags_blog',
     143            'registration',
     144            'fileupload_mask',
     145        )
     146    );
     147
     148    if ( in_array( $option, $keys, true ) ) {
    146149        wp_cache_delete( 'root_blog_options', 'bp' );
    147150    }
     
    207210        $args,
    208211        array(
    209             'object_ids'       => array(), // Comma-separated list or array of item ids.
    210             'object_type'      => '',      // Canonical component id: groups, members, etc.
     212            'object_ids'       => array(), // Comma-separated list or array of item ids.
     213            'object_type'      => '',      // Canonical component id: groups, members, etc.
    211214            'cache_group'      => '',      // Cache group.
    212             'meta_table'       => '',      // Name of the table containing the metadata.
     215            'meta_table'       => '',      // Name of the table containing the metadata.
    213216            'object_column'    => '',      // DB column for the object ids (group_id, etc).
    214217            'cache_key_prefix' => '',      // Prefix to use when creating cache key names. Eg 'bp_groups_groupmeta'.
     
    246249        if ( ! empty( $meta_list ) ) {
    247250            foreach ( $meta_list as $metarow ) {
    248                 $mpid = intval( $metarow[$object_column] );
     251                $mpid = intval( $metarow[ $object_column ] );
    249252                $mkey = $metarow['meta_key'];
    250253                $mval = $metarow['meta_value'];
    251254
    252255                // Force subkeys to be array type.
    253                 if ( !isset( $cache[$mpid] ) || !is_array( $cache[$mpid] ) )
    254                     $cache[$mpid] = array();
    255                 if ( !isset( $cache[$mpid][$mkey] ) || !is_array( $cache[$mpid][$mkey] ) )
    256                     $cache[$mpid][$mkey] = array();
     256                if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) {
     257                    $cache[ $mpid ] = array();
     258                }
     259                if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) {
     260                    $cache[ $mpid ][ $mkey ] = array();
     261                }
    257262
    258263                // Add a value to the current pid/key.
    259                 $cache[$mpid][$mkey][] = $mval;
     264                $cache[ $mpid ][ $mkey ][] = $mval;
    260265            }
    261266        }
     
    345350function bp_core_get_incremented_cache_key( $key, $group ) {
    346351    $incrementor = bp_core_get_incrementor( $group );
    347     $cache_key = md5( $key . $incrementor );
     352    $cache_key   = md5( $key . $incrementor );
    348353    return $cache_key;
    349354}
     
    414419 * @since 7.0.0
    415420 *
    416  * @param int $type_id The Type's term ID.
     421 * @param int    $type_id The Type's term ID.
    417422 * @param string $taxonomy The Type's taxonomy name.
    418423 */
Note: See TracChangeset for help on using the changeset viewer.