Opened 15 years ago
Closed 9 years ago
#11384 closed defect (bug) (duplicate)
rewrite->flush() needlessly deletes the rewrite_rules option
Reported by: | Denis-de-Bernardy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.9 |
Component: | Rewrite Rules | Keywords: | has-patch needs-testing needs-unit-tests |
Focuses: | performance | Cc: |
Description
All sorts of cache-related plugins hook into the update_option_rewrite_rules and force-flush whatever they're caching when rewrite_rules are updated.
When a page is saved, WP_Rewrite::flush() mindlessly deletes the rewrite_rule option, triggering all sorts of cache flushing that may or may not be necessary.
The attached patch keeps the rewrite_rules option intact when a soft refresh occurs.
Tests done:
- non-verbose rules used, page changes parent: no refresh
- verbose rules used, page changes parent: refresh
Dunno what else needs to be testing...
Attachments (2)
Change History (13)
#7
follow-up:
↓ 8
@
9 years ago
- Keywords needs-testing added; needs-refresh removed
I have refreshed the patch but can't determine how to test it properly. :(
#8
in reply to:
↑ 7
@
9 years ago
- Keywords needs-unit-tests added
- Milestone changed from Future Release to 4.5
Hi @brokenflipside, thanks for the refresh! Let's also add a changelog entry to the DocBlock for the new parameter while we're at it. More on changelogs in the core contributor handbook.
Replying to brokenflipside:
I have refreshed the patch but can't determine how to test it properly. :(
A good place to start would be phpunit/tests/rewrite.php. I'd suggest taking a look at how some of the other methods are being tested.
For example, start by declaring the $wp_rewrite
global in order to access running the method, then perhaps test the existence of the option before and after the method is run.
Patch still applies cleanly.