[wpmu-trac] [WordPress MU Trac] #669: Better DB cleanup when
deleting blogs.
WordPress MU Trac
wpmu-trac at lists.automattic.com
Tue Jul 1 18:12:43 GMT 2008
#669: Better DB cleanup when deleting blogs.
------------------------+---------------------------------------------------
Reporter: lunabyte | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: component1 | Version:
Severity: normal | Keywords: db cleanup
------------------------+---------------------------------------------------
Pretty much what the title says.
Why go in and add a table name whenever you add plugins, or other goodies?
What a hassle when MU can do the work for us.
/wp-admin/includes/mu.php
Around: line 43 (as of r1339)
<search>
if ( $drop ) {
$drop_tables = array( $wpdb->base_prefix . $blog_id .
"_categories",
$wpdb->base_prefix . $blog_id . "_comments",
$wpdb->base_prefix . $blog_id . "_linkcategories",
$wpdb->base_prefix . $blog_id . "_links",
$wpdb->base_prefix . $blog_id . "_link2cat",
$wpdb->base_prefix . $blog_id . "_options",
$wpdb->base_prefix . $blog_id . "_post2cat",
$wpdb->base_prefix . $blog_id . "_postmeta",
$wpdb->base_prefix . $blog_id . "_posts",
$wpdb->base_prefix . $blog_id . "_terms",
$wpdb->base_prefix . $blog_id . "_term_taxonomy",
$wpdb->base_prefix . $blog_id . "_term_relationships" );
$drop_tables = apply_filters( 'wpmu_drop_tables',
$drop_tables );
reset( $drop_tables );
foreach ( (array) $drop_tables as $drop_table) {
$wpdb->query( "DROP TABLE IF EXISTS $drop_table"
);
}
</search>
<replace>
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 );
foreach ( (array) $drop_tables as $drop_table => $name ) {
$wpdb->query( "DROP TABLE IF EXISTS ". current(
$name ) ."" );
}
</replace>
--
Ticket URL: <http://trac.mu.wordpress.org/ticket/669>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser
More information about the wpmu-trac
mailing list