Hi,
We found a big bug in this function. It deletes 11 blogs instead just one.
The error is located here:
...
if ( $drop ) {
$drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "_%'", ARRAY_A);
$drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
reset( $drop_tables );
...
For example, if the blog_id is 3, the show tables match the tables
wp_3ANY CHARACTERand any characters
This match wp_3..., wp_31..., wp_32...
The problem is the "_" in the LIKE clause, it must be escaped...
...
if ( $drop ) {
$drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
$drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
reset( $drop_tables );
...
Best regards.