Skip to content

Commit 4fc68ff

Browse files
committed
CS changes
1 parent 80a88b6 commit 4fc68ff

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/DB_Command.php

+23-4
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,36 @@ public function reset( $_, $assoc_args ) {
144144
* @when after_wp_load
145145
*/
146146
public function clean( $_, $assoc_args ) {
147-
WP_CLI::confirm( "Are you sure you want to drop all the tables on '" . DB_NAME . "' that uses the WordPress database prefix?", $assoc_args );
147+
global $wpdb;
148+
149+
WP_CLI::confirm(
150+
sprintf(
151+
"Are you sure you want to drop all the tables on '%s' that use the current site's database prefix ('%s')?",
152+
DB_NAME,
153+
$wpdb->get_blog_prefix()
154+
),
155+
$assoc_args
156+
);
148157

149158
$mysql_args = self::get_dbuser_dbpass_args( $assoc_args );
150159

151-
$tables = WP_CLI\Utils\wp_get_table_names( array(), array( 'all-tables-with-prefix' ) );
160+
$tables = WP_CLI\Utils\wp_get_table_names(
161+
array(),
162+
array( 'all-tables-with-prefix' )
163+
);
152164

153165
foreach ( $tables as $table ) {
154-
self::run_query( sprintf( 'DROP TABLE IF EXISTS `%s`.`%s`', DB_NAME, $table ), $mysql_args );
166+
self::run_query(
167+
sprintf(
168+
'DROP TABLE IF EXISTS `%s`.`%s`',
169+
DB_NAME,
170+
$table
171+
),
172+
$mysql_args
173+
);
155174
}
156175

157-
WP_CLI::success( "Tables dropped." );
176+
WP_CLI::success( 'Tables dropped.' );
158177
}
159178

160179
/**

0 commit comments

Comments
 (0)