Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/09/2019 05:35:42 AM (4 years ago)
Author:
johnjamesjacoby
Message:

Counts (meta-data): full audit of forum/topic/reply, public/non-public counts.

This commit is the result of a full count audit, exposing multiple inconsistencies and voids in relation to how public and non-public counts are (re)calculated.

For instance, hidden forum replies are not counted at all, until now. By introducing a new Repair tool, hidden forum reply counts are now counted.

In addition, there were multiple bugs with topic & reply moderation, where the act of approving or unapproving topics or replies would cause the numbers to be inaccurate, or where topics & replies being caught in moderation were still increasing public counts.

It was also possible to, as a Key Master, publicly reply to unapproved topics, which was a completely unanticipated side-effect of allowing Key Masters to do pretty much anything. Going forward, the default reply status is the topic status, but is still beholden to all existing moderation settings and user role capabilities. This results in a more sane user experience, and prevents the unusual circumstance of there being "0 topics and 30 replies" in public-facing forums.

Certain count increase/decrease actions have been reprioritized to avoid collisions and race conditions, proving once again that ya gotta get up to get down.

See #2838. Fixes #1799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/tools.php

    r6897 r6923  
    241241    ) );
    242242
     243    // Count non-published replies to each forum
     244    bbp_register_repair_tool( array(
     245        'id'          => 'bbp-forum-hidden-replies',
     246        'type'        => 'repair',
     247        'title'       => esc_html__( 'Recount pending, spammed, and trashed replies in each forum', 'bbpress' ),
     248        'description' => esc_html__( 'Run this if non-public replies display incorrectly in forums.', 'bbpress' ),
     249        'callback'    => 'bbp_admin_repair_forum_hidden_reply_count',
     250        'priority'    => 60,
     251        'overhead'    => 'high',
     252        'components'  => array( bbp_get_forum_post_type(), bbp_get_reply_post_type() )
     253    ) );
     254
    243255    // Count topic replies
    244256    bbp_register_repair_tool( array(
     
    248260        'description' => esc_html__( 'Run this if the number of topics in any topics are incorrect.', 'bbpress' ),
    249261        'callback'    => 'bbp_admin_repair_topic_reply_count',
    250         'priority'    => 60,
     262        'priority'    => 65,
    251263        'overhead'    => 'high',
    252264        'components'  => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() )
     
    258270        'type'        => 'repair',
    259271        'title'       => esc_html__( 'Recount pending, spammed, and trashed replies in each topic', 'bbpress' ),
    260         'description' => esc_html__( 'Run this if non-public replies display incorrectly.', 'bbpress' ),
     272        'description' => esc_html__( 'Run this if non-public replies display incorrectly in topics.', 'bbpress' ),
    261273        'callback'    => 'bbp_admin_repair_topic_hidden_reply_count',
    262         'priority'    => 65,
     274        'priority'    => 70,
    263275        'overhead'    => 'high',
    264276        'components'  => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() )
     
    272284        'description' => esc_html__( 'Run this to get fresh topic counts for all users.', 'bbpress' ),
    273285        'callback'    => 'bbp_admin_repair_user_topic_count',
    274         'priority'    => 70,
     286        'priority'    => 75,
    275287        'overhead'    => 'medium',
    276288        'components'  => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() )
     
    284296        'description' => esc_html__( 'Run this to get fresh reply counts for all users.', 'bbpress' ),
    285297        'callback'    => 'bbp_admin_repair_user_reply_count',
    286         'priority'    => 75,
     298        'priority'    => 80,
    287299        'overhead'    => 'medium',
    288300        'components'  => array( bbp_get_reply_post_type(), bbp_get_user_rewrite_id() )
     
    296308        'description' => esc_html__( 'Run this to remove trashed or deleted topics from all user favorites.', 'bbpress' ),
    297309        'callback'    => 'bbp_admin_repair_user_favorites',
    298         'priority'    => 80,
     310        'priority'    => 85,
    299311        'overhead'    => 'medium',
    300312        'components'  => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() )
     
    308320        'description' => esc_html__( 'Run this to remove trashed or deleted topics from all user subscriptions.', 'bbpress' ),
    309321        'callback'    => 'bbp_admin_repair_user_topic_subscriptions',
    310         'priority'    => 85,
     322        'priority'    => 90,
    311323        'overhead'    => 'medium',
    312324        'components'  => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() )
     
    320332        'description' => esc_html__( 'Run this to remove trashed or deleted forums from all user subscriptions.', 'bbpress' ),
    321333        'callback'    => 'bbp_admin_repair_user_forum_subscriptions',
    322         'priority'    => 90,
     334        'priority'    => 95,
    323335        'overhead'    => 'medium',
    324336        'components'  => array( bbp_get_forum_post_type(), bbp_get_user_rewrite_id() )
     
    332344        'description' => esc_html__( 'Run this if users have issues accessing the forums.', 'bbpress' ),
    333345        'callback'    => 'bbp_admin_repair_user_roles',
    334         'priority'    => 95,
     346        'priority'    => 100,
    335347        'overhead'    => 'low',
    336348        'components'  => array( bbp_get_user_rewrite_id() )
     
    344356        'description' => esc_html__( 'Copies engagements from user meta to topic meta.', 'bbpress' ),
    345357        'callback'    => 'bbp_admin_upgrade_user_engagements',
    346         'priority'    => 100,
     358        'priority'    => 105,
    347359        'version'     => '2.6.0',
    348360        'overhead'    => 'high',
     
    357369        'description' => esc_html__( 'Copies favorites from user meta to topic meta.', 'bbpress' ),
    358370        'callback'    => 'bbp_admin_upgrade_user_favorites',
    359         'priority'    => 105,
     371        'priority'    => 110,
    360372        'version'     => '2.6.0',
    361373        'overhead'    => 'high',
     
    370382        'description' => esc_html__( 'Copies topic subscriptions from user meta to topic meta.', 'bbpress' ),
    371383        'callback'    => 'bbp_admin_upgrade_user_topic_subscriptions',
    372         'priority'    => 110,
     384        'priority'    => 115,
    373385        'version'     => '2.6.0',
    374386        'overhead'    => 'high',
     
    383395        'description' => esc_html__( 'Copies forum subscriptions from user meta to forum meta.', 'bbpress' ),
    384396        'callback'    => 'bbp_admin_upgrade_user_forum_subscriptions',
    385         'priority'    => 115,
     397        'priority'    => 120,
    386398        'version'     => '2.6.0',
    387399        'overhead'    => 'high',
     
    396408        'description' => esc_html__( 'Run this to delete old data (after confirming successful favorites upgrade)', 'bbpress' ),
    397409        'callback'    => 'bbp_admin_upgrade_remove_favorites_from_usermeta',
    398         'priority'    => 120,
     410        'priority'    => 125,
    399411        'version'     => '2.6.1',
    400412        'overhead'    => 'medium',
     
    409421        'description' => esc_html__( 'Run this to delete old data (after confirming successful topic subscriptions upgrade)', 'bbpress' ),
    410422        'callback'    => 'bbp_admin_upgrade_remove_topic_subscriptions_from_usermeta',
    411         'priority'    => 125,
     423        'priority'    => 130,
    412424        'version'     => '2.6.1',
    413425        'overhead'    => 'medium',
     
    422434        'description' => esc_html__( 'Run this to delete old data (after confirming successful forum subscriptions upgrade)', 'bbpress' ),
    423435        'callback'    => 'bbp_admin_upgrade_remove_forum_subscriptions_from_usermeta',
    424         'priority'    => 130,
     436        'priority'    => 135,
    425437        'version'     => '2.6.1',
    426438        'overhead'    => 'medium',
     
    435447        'description' => esc_html__( 'Run this if you just upgraded BuddyPress Forums from Legacy.', 'bbpress' ),
    436448        'callback'    => 'bbp_admin_upgrade_group_forum_relationship',
    437         'priority'    => 135,
     449        'priority'    => 140,
    438450        'overhead'    => 'low',
    439451        'components'  => array( bbp_get_forum_post_type() )
Note: See TracChangeset for help on using the changeset viewer.