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/topics/functions.php

    r6827 r6848  
    833833        bbp_update_topic_walker( $topic_id, $last_active, $forum_id, 0, false );
    834834    }
     835
     836    // Bump the custom query cache
     837    wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' );
    835838}
    836839
     
    888891            if ( bbp_is_forum( $ancestor ) ) {
    889892
     893                // Get the forum
     894                $forum = bbp_get_forum( $ancestor );
     895
    890896                // Update the forum
    891897                bbp_update_forum( array(
    892                     'forum_id'           => $ancestor,
     898                    'forum_id'           => $forum->ID,
     899                    'post_parent'        => $forum->post_parent,
    893900                    'last_topic_id'      => $topic_id,
    894901                    'last_reply_id'      => $reply_id,
     
    984991
    985992    // Get reply count.
    986     $public_reply_count = count( bbp_get_public_child_ids( $topic_id, bbp_get_reply_post_type() ) );
     993    $public_reply_count = bbp_get_public_child_count( $topic_id, bbp_get_reply_post_type() );
    987994
    988995    // Topic status.
Note: See TracChangeset for help on using the changeset viewer.