Changeset 7023 for branches/2.6/src/includes/common/engagements.php
- Timestamp:
- 12/11/2019 04:05:08 PM (6 years ago)
- File:
-
- 1 edited
-
branches/2.6/src/includes/common/engagements.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/src/includes/common/engagements.php
r7004 r7023 612 612 private function get_cache_key( $meta_key = '', $object_id = 0 ) { 613 613 614 // No negative numbers in cache keys 615 $object_id = absint( $object_id ); 616 614 617 // Maybe guess at post type 615 618 $post_type = ! empty( $object_id ) … … 641 644 } 642 645 643 // Return the old (pluralized) user option key 644 return $key;646 // Return the old (pluralized) user option key with object ID appended 647 return "{$key}{$object_id}"; 645 648 } 646 649 … … 661 664 $cache_key = $this->get_cache_key( $meta_key, $object_id ); 662 665 663 return wp_cache_get( $cache_key, 'bbpress_ users' );666 return wp_cache_get( $cache_key, 'bbpress_posts' ); 664 667 } 665 668 … … 740 743 $retval = update_user_option( $user_id, $option_key, $object_ids ); 741 744 742 // Delete cache , if successful743 if ( true === $retval ) {745 // Delete cache if successful (accounts for int & true) 746 if ( false !== $retval ) { 744 747 $this->cache_delete( $meta_key, $object_id ); 745 748 } … … 777 780 : delete_user_option( $user_id, $option_key ); 778 781 779 // Delete cache , if successful780 if ( true === $retval ) {782 // Delete cache if successful (accounts for int & true) 783 if ( false !== $retval ) { 781 784 $this->cache_delete( $meta_key, $object_id ); 782 785 } … … 806 809 $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) ); 807 810 808 // Attempt to delete the 811 // Attempt to delete the user option 809 812 $retval = delete_user_option( $user_id, $option_key ); 810 813 811 814 // Try to delete caches, but only if everything else succeeded 812 815 if ( ! empty( $retval ) && ! empty( $object_ids ) ) { 813 foreach ( $object_ids as $object_id ) {816 foreach ( $object_ids as $object_id ) { 814 817 $this->cache_delete( $meta_key, $object_id ); 815 818 }
Note: See TracChangeset
for help on using the changeset viewer.