#46125 closed defect (bug) (fixed)
No cache cleanup after populate_options action call
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.1 | Priority: | high |
Severity: | normal | Version: | 5.1 |
Component: | Networks and Sites | Keywords: | has-patch has-unit-tests commit |
Focuses: | multisite | Cc: |
Description
With the refactoring of new site creation, there seems to be a backward incompatibility being introduced.
Previously, calling get_blog_details
from within populate_options
action callback, created a cache, which got properly purged, which does not seem to be the case anymore.
Hooking a callback to populate_options
which calls get_blog_details
caches the blog's values at the state at which those are prior the options population - eg.: false
for siteurl
.
Seems like it can be fixed by calling clean_blog_cache
right after the populate_options
in the wp_initialize_site
function, which was the case prior the refactor.
I'm attaching a unit test covering such behaviour and a patch for this backward compatibility breaking change.
Attachments (2)
Change History (11)
#3
@
6 years ago
Hey Jonny, thanks for getting back!
Have you got an example code where we can see the break?
The example code was used in the unit test provided along with the patch - it's the bare minimum for reproducing the faulty behaviour. Both, the wpmu_create_blog
and update_option
were used in there, as it's part of the code which is in place in the implementation where I tested the patch, that's why those were used in there.
I know that wpmu_create_blog
is being deprecated, but I think that the backward compatibility is being broken in here.
Hope it helps!
#4
@
6 years ago
- Keywords has-patch has-unit-tests commit added
- Priority changed from normal to high
#5
@
6 years ago
@david.binda I updated the patch and tested the solution.
I think we are good to go and this should be merged for 5.1
Thanks for the ticket here @davidbinda .
Have you got an example code where we can see the break?
As for the patch couple bit of feedback.
clean_blog_cache( get_current_blog_id() );
should beclean_blog_cache( $site );
. We have the site object to hand, we should use it.$factory->blog->create( $id );
update_option
useupdate_blog_option