Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 11 years ago

#2294 closed defect (bug) (fixed)

bbp_get_public_child_ids()'s cache key not unique in multisite

Reported by: wpdennis's profile wpdennis Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2.3
Component: General Keywords: dev-feedback
Cc:

Description

I have a multisite installation with bbpress 2.2.4. If I insert new topics programmatically via bbp_insert_topic(), the topic count isn't always increased.

During debugging I found this issue:

bbp_get_public_child_ids() is used to calculate the topic count in bbp_update_forum_topic_count() and uses the cache group "bbpress" with this key:

$cache_id    = 'bbp_parent_public_' . $parent_id . '_type_' . $post_type . '_child_ids';
[...]
$child_ids = wp_cache_get( $cache_id, 'bbpress' );

But this group is added as a global group in setup_globals():

wp_cache_add_global_groups( 'bbpress' );

So, in a multisite installation with multiple forums on different blogs, the key is not unique if 2 forums have the same id.

Maybe this isn't the only issue related with bbpress as a global cache group?

I'm not deep enough into bbpress, but are there any benefits of a global cache group at all? What, if I have different configurations in 2 installations? Would every cached value overwrite the individual option for each other blog, too?

Change History (4)

#1 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to 2.4

Good catch. There are a few other places bbPress uses its own cache keys, and they're going to suffer a similar fate. Too late for 2.3, but might be able to fit this into a 2.3.x release. Moving to 2.4 in the meanwhile.

#2 @wpdennis
11 years ago

Thank you John.

Is there any advantage of adding bbpress as a global group in the first place? Every installation uses the custom post types of each individual blog, right? Therefore it needs his own separate caching. So if setup_globals() wouldn't call wp_cache_add_global_groups() it would be solved. Or am I missing something?

Last edited 11 years ago by wpdennis (previous) (diff)

#3 @johnjamesjacoby
11 years ago

  • Milestone changed from 2.4 to 2.3

After some testing, you're totally correct. Going to remove this, and update the cache groups to be a bit more descriptive for 2.3.

#4 @johnjamesjacoby
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4848]) Remove the global cache group, and update existing cache group keys to be more descriptive. Fixes issues with cached queries stomping each other on multisite installations. Fixes #2294.

Note: See TracTickets for help on using tickets.