Skip to content

Commit 897a387

Browse files
committed
Use TRUNCATE TABLE
This works better with the SQLite plugin right now. See WordPress/sqlite-database-integration#51
1 parent 1130df8 commit 897a387

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Site_Command.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ private function empty_comments() {
5252
wp_cache_delete( $comment_id, 'comment' );
5353
wp_cache_delete( $comment_id, 'comment_meta' );
5454
}
55-
$wpdb->query( "TRUNCATE $wpdb->comments" );
56-
$wpdb->query( "TRUNCATE $wpdb->commentmeta" );
55+
$wpdb->query( "TRUNCATE TABLE $wpdb->comments" );
56+
$wpdb->query( "TRUNCATE TABLE $wpdb->commentmeta" );
5757
}
5858

5959
/**
@@ -80,8 +80,8 @@ private function empty_posts() {
8080

8181
$posts->next();
8282
}
83-
$wpdb->query( "TRUNCATE $wpdb->posts" );
84-
$wpdb->query( "TRUNCATE $wpdb->postmeta" );
83+
$wpdb->query( "TRUNCATE TABLE $wpdb->posts" );
84+
$wpdb->query( "TRUNCATE TABLE $wpdb->postmeta" );
8585
}
8686

8787
/**
@@ -110,11 +110,11 @@ private function empty_taxonomies() {
110110
wp_cache_delete( 'get', $taxonomy );
111111
delete_option( "{$taxonomy}_children" );
112112
}
113-
$wpdb->query( "TRUNCATE $wpdb->terms" );
114-
$wpdb->query( "TRUNCATE $wpdb->term_taxonomy" );
115-
$wpdb->query( "TRUNCATE $wpdb->term_relationships" );
113+
$wpdb->query( "TRUNCATE TABLE $wpdb->terms" );
114+
$wpdb->query( "TRUNCATE TABLE $wpdb->term_taxonomy" );
115+
$wpdb->query( "TRUNCATE TABLE $wpdb->term_relationships" );
116116
if ( ! empty( $wpdb->termmeta ) ) {
117-
$wpdb->query( "TRUNCATE $wpdb->termmeta" );
117+
$wpdb->query( "TRUNCATE TABLE $wpdb->termmeta" );
118118
}
119119
}
120120

@@ -143,7 +143,7 @@ private function empty_links() {
143143
}
144144

145145
// Empty the table once link related cache and term is removed.
146-
$wpdb->query( "TRUNCATE {$wpdb->links}" );
146+
$wpdb->query( "TRUNCATE TABLE {$wpdb->links}" );
147147
}
148148

149149
/**

0 commit comments

Comments
 (0)