Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/09/2018 07:53:28 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Tests: get all post type/status counts using bbp_get_child_counts().

  • Fix a broken test, and improve a few others
  • Update several count() instances that were doing expensive _ids() counts
  • Strategically bust the bbpress_posts query cache group on updates

This change improves general performance and count reliability by ensuring the accuracy of forum/topic/reply relationship totals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/functions.php

    r6826 r6848  
    9999    if ( bbp_is_reply_published( $reply_id ) ) {
    100100        bbp_increase_topic_reply_count( $topic_id );
    101         bbp_increase_forum_reply_count( $reply_id );
     101        bbp_increase_forum_reply_count( $forum_id );
    102102
    103103    // If the reply isn't public only update the topic reply hidden count.
     
    856856        bbp_update_reply_walker( $reply_id, $last_active_time, $forum_id, $topic_id, false );
    857857    }
     858
     859    // Bump the custom query cache
     860    wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' );
    858861}
    859862
     
    10021005
    10031006    // Update the forum ID
    1004     $forum_id = bbp_update_forum_id( $reply_id, $forum_id );
     1007    $retval = bbp_update_forum_id( $reply_id, $forum_id );
    10051008
    10061009    // Filter & return
    1007     return (int) apply_filters( 'bbp_update_reply_forum_id', $forum_id, $reply_id );
     1010    return (int) apply_filters( 'bbp_update_reply_forum_id', $retval, $reply_id, $forum_id );
    10081011}
    10091012
     
    10451048
    10461049    // Update the topic ID
    1047     $topic_id = bbp_update_topic_id( $reply_id, $topic_id );
     1050    $retval = bbp_update_topic_id( $reply_id, $topic_id );
    10481051
    10491052    // Filter & return
    1050     return (int) apply_filters( 'bbp_update_reply_topic_id', $topic_id, $reply_id );
     1053    return (int) apply_filters( 'bbp_update_reply_topic_id', $retval, $reply_id, $topic_id );
    10511054}
    10521055
Note: See TracChangeset for help on using the changeset viewer.