* Register blog-id-cache group as global

* Introduce clean_blog_cache() so we can run it independently of refresh_blog_details() which assumes the blog still exists and get_blog_details() can be called.
* Don't db escape cache keys in get_blog_id_from_url()
* prepare() the query in get_blog_id_from_url()
* Return 0 for all failures in get_blog_id_from_url()
* clean_blog_cache() after dropping tables in wpmu_delete_blog() to make sure the cache is for real cleaned.



git-svn-id: https://develop.svn.wordpress.org/trunk@22092 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-10-01 18:03:23 +00:00
parent 0d5f429651
commit 42cfdfb614
4 changed files with 39 additions and 24 deletions
+5 -5
View File
@@ -55,14 +55,13 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb, $current_site;
$switch = false;
if ( $blog_id != $wpdb->blogid ) {
if ( get_current_blog_id() != $blog_id ) {
$switch = true;
switch_to_blog( $blog_id );
$blog = get_blog_details( $blog_id );
} else {
$blog = $GLOBALS['current_blog'];
}
$blog = get_blog_details( $blog_id );
do_action( 'delete_blog', $blog_id, $drop );
$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
@@ -81,7 +80,6 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
$drop = false;
if ( $drop ) {
$drop_tables = apply_filters( 'wpmu_drop_tables', $wpdb->tables( 'blog' ) );
foreach ( (array) $drop_tables as $table ) {
@@ -122,6 +120,8 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
if ( $dir != $top_dir)
@rmdir( $dir );
}
clean_blog_cache( $blog );
}
if ( $switch )