Skip to:
Content

Opened 4 years ago

Closed 3 years ago

#2813 closed enhancement (fixed)

Improvements to bbp_clean_post_cache()

Reported by: thebrandonallen Owned by: thebrandonallen
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: API - Cache Keywords: has-patch has-unit-tests
Cc:

Description

In r5774 when moved the majority of our cache validation to WP's clean_post_cache hook. This hook can pass both the post id an the post object. However, we don't currently accept a second parameter in bbp_clean_post_cache(). Attached patch allows a second parameter to be passed, and updates our add_action call to send both parameters.

This change also reduces our current full suite test time by about 0.2 seconds. This should make difference as we flesh out the test suite, and should also result in a speed bump, however minor, during normal operation.

Attachments (2)

2813.01.patch (4.0 KB) - added by thebrandonallen 4 years ago.
2813.02.patch (5.0 KB) - added by thebrandonallen 3 years ago.

Download all attachments as: .zip

Change History (7)

#1 @thebrandonallen
3 years ago

  • Milestone changed from Awaiting Review to 2.6

#2 @thebrandonallen
3 years ago

  • Keywords needs-unit-tests added
  • Owner set to thebrandonallen

#3 @thebrandonallen
3 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

Refreshed patch to remove keys no longer used in 2.6, clean up PHPDoc, and adds unit tests.

The unit tests may seem bare, but the cache keys tested were the only meaningful tests. The assumption being that if it can handle those keys well, it should be fine with the others. Plus, if we ever break bbp_clean_post_cache, we'll know quickly, because a large number of our tests will start failing 😞

#4 @netweb
3 years ago

In 6053:

Tests: Introduce tests for the cache functions.

Props thebrandonallen.
See #2813

#5 @netweb
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 6054:

Cache: Allow a second parameter to be passed to bbp_clean_post_cache()

Following [5774] WP's clean_post_cache hook can pass both post ID and the post object, this changeset allows that second parmeter to be passed to bbp_clean_post_cache() and updates our add_action call to send both parameters.

Props thebrandonallen.
Fixes #2813.

Note: See TracTickets for help on using tickets.