Opened 13 years ago
Closed 12 years ago
#20950 closed defect (bug) (fixed)
wpmu_delete_blog leaves zombie cache objects
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
For example cached objects with keys like current_blog_{$domain}, current_blog_{$domain}, get_id_from_blogname_{$name} will be left to haunt the network even after the blog is deleted.
Symptoms will be not being allowed to create blogs with the same name after it's deleted, blog settings of old blogs creeping into newly created blogs.
Attachments (5)
Change History (20)
#2
@
12 years ago
Noticing the escaping as well. Are the values escaped on storage, hence the bug report suggesting that all three cache entries are not cleared?
#4
@
12 years ago
Refreshed
wp_cache_delete( md5( $details->domain . $details->path ) , 'blog-lookup' );
Actually needs to be:
wp_cache_delete( md5( $wpdb->escape( $details->domain ) . $wpdb->escape( $details->path ) ) , 'blog-lookup' );
#6
@
12 years ago
I think get_blog_details( $blog_id, false ) needs to become get_blog_details( $blog_id, true ) to get the blogname.
#7
@
12 years ago
get_id_from_blogname( )actually expects a path, but you can't pass get_blog_details()->path directly to it because of trailing slash problems.
#8
@
12 years ago
get_id_from_blogname() actually takes an unslashed path rather than a blogname so I updated the variables and phpdoc to use the term slug instead of name.
- Rename $name to $slug for some clarity.
- Strip leading and trailing slashes from the slug in get_id_from_blogname() so get_blog_details()->path could be directly passed
- Delete the get_id_from_blogname cache in refresh_blog_details()
#9
@
12 years ago
Unit tests and a fix to WP_UnitTest_Factory_For_Blog that prepends global $base to the path when creating blogs with generated defaults. get_id_from_blogname() expects "/testpath1/" to be in the DB but the factory was creating "testpath1/".
#10
@
12 years ago
Still looking at the blog-lookup cache. In the unit tests sometimes the domain + path passed to get_blog_details() is "example.org" and sometimes "example.org/". I haven't yet looked at what mischief core does during blog creation.
#11
@
12 years ago
The domain and path used for the details blog-lookup key are consistent so far when testing blog create, delete, edit, and load. They're not slashed for the db AFAICT. I haven't tested through signup yet.
I feel dirty after debugging this. Here's the flow:
1) call
wpmu_delete_blog()
2) It calls
update_blog_status( $blog_id, 'deleted', 1 );
3) ...which calls
refresh_blog_details($blog_id);
4) Which does:
5) ...but was missing:
One line patch.