Changeset 6585
- Timestamp:
- 06/19/2017 05:05:18 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/core/actions.php
r6551 r6585 385 385 add_action( 'bbp_user_edit_after', 'bbp_user_edit_after' ); 386 386 387 // New forum/topic/reply caches388 // @todo Investigate why clearing is necessary on both pre & post hooks389 add_action( 'bbp_new_forum_pre_extras', 'bbp_clean_post_cache' );390 add_action( 'bbp_new_forum_post_extras', 'bbp_clean_post_cache' );391 add_action( 'bbp_new_topic_pre_extras', 'bbp_clean_post_cache' );392 add_action( 'bbp_new_topic_post_extras', 'bbp_clean_post_cache' );393 add_action( 'bbp_new_reply_pre_extras', 'bbp_clean_post_cache' );394 add_action( 'bbp_new_reply_post_extras', 'bbp_clean_post_cache' );395 396 387 // Clean bbPress post caches when WordPress's is cleaned 397 388 add_action( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 ); -
trunk/src/includes/core/cache.php
r6583 r6585 136 136 function bbp_clean_post_cache( $post_id = null, $post = null ) { 137 137 138 // Get the post object.139 if ( null !== $post ) {140 $post = get_post( $post );141 } else {142 $post = get_post( $post_id );143 }144 145 // Bail if no post146 if ( empty( $post ) ) {147 return;148 }149 150 138 // Child query types to clean 151 139 $post_types = array( … … 159 147 return; 160 148 } 161 162 // Be sure we haven't recached the post data163 wp_cache_delete( $post->ID, 'posts' );164 wp_cache_delete( $post->ID, 'post_meta' );165 166 // Clean the term cache for the given post167 clean_object_term_cache( $post->ID, $post->post_type );168 169 // Bump the last_changed cache170 wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' );171 149 172 150 /** … … 182 160 // Invalidate parent caches 183 161 if ( ! empty( $post->post_parent ) ) { 184 bbp_clean_post_cache( $post->post_parent ); 162 clean_post_cache( $post->post_parent ); 163 164 // Only bump `last_changed` when forum-root is reached 165 } else { 166 wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' ); 185 167 } 186 168 } -
trunk/src/includes/forums/functions.php
r6583 r6585 833 833 $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) ); 834 834 wp_transition_post_status( bbp_get_public_status_id(), $current_visibility, get_post( $forum_id ) ); 835 bbp_clean_post_cache( $forum_id );835 clean_post_cache( $forum_id ); 836 836 } 837 837 … … 882 882 $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_private_status_id() ), array( 'ID' => $forum_id ) ); 883 883 wp_transition_post_status( bbp_get_private_status_id(), $current_visibility, get_post( $forum_id ) ); 884 bbp_clean_post_cache( $forum_id );884 clean_post_cache( $forum_id ); 885 885 } 886 886 … … 931 931 $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_hidden_status_id() ), array( 'ID' => $forum_id ) ); 932 932 wp_transition_post_status( bbp_get_hidden_status_id(), $current_visibility, get_post( $forum_id ) ); 933 bbp_clean_post_cache( $forum_id );933 clean_post_cache( $forum_id ); 934 934 } 935 935 -
trunk/src/includes/topics/functions.php
r6573 r6585 911 911 // Clean old and new forum caches before proceeding, to ensure subsequent 912 912 // calls to forum objects are using updated data. 913 bbp_clean_post_cache( $old_forum_id );914 bbp_clean_post_cache( $new_forum_id );913 clean_post_cache( $old_forum_id ); 914 clean_post_cache( $new_forum_id ); 915 915 916 916 // Update topic forum's ID -
trunk/tests/phpunit/testcases/admin/tools.php
r6524 r6585 161 161 bbp_admin_repair_topic_voice_count(); 162 162 163 bbp_clean_post_cache( $t );163 clean_post_cache( $t ); 164 164 165 165 $count = bbp_get_topic_voice_count( $t ); … … 215 215 bbp_admin_repair_topic_hidden_reply_count(); 216 216 217 bbp_clean_post_cache( $t );217 clean_post_cache( $t ); 218 218 219 219 $count = bbp_get_topic_reply_count_hidden( $t, true ); … … 662 662 bbp_admin_repair_forum_meta(); 663 663 664 bbp_clean_post_cache( $f );665 bbp_clean_post_cache( $t );666 bbp_clean_post_cache( $r );664 clean_post_cache( $f ); 665 clean_post_cache( $t ); 666 clean_post_cache( $r ); 667 667 668 668 // Forums should NOT have a _bbp_forum_id meta key -
trunk/tests/phpunit/testcases/core/cache.php
r6584 r6585 49 49 50 50 // Clean the cache. 51 bbp_clean_post_cache( $r );51 clean_post_cache( $r ); 52 52 53 53 // Setup -
trunk/tests/phpunit/testcases/topics/functions/counts.php
r6330 r6585 127 127 128 128 // ToDo: Update this to use bbp_delete_reply(). 129 bbp_clean_post_cache( $t );129 clean_post_cache( $t ); 130 130 wp_delete_post( $r2, true ); 131 131
Note: See TracChangeset
for help on using the changeset viewer.