Skip to content

Commit 7caad96

Browse files
committed
Move debug statements around
1 parent f5794f5 commit 7caad96

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/DB_Command.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,14 @@ public function check( $_, $assoc_args ) {
227227

228228
$command = sprintf( '/usr/bin/env mysqlcheck%s %s', $this->get_defaults_flag_string( $assoc_args ), '%s' );
229229
WP_CLI::debug( "Running shell command: {$command}", 'db' );
230-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
231230

232231
$assoc_args['check'] = true;
233232
self::run(
234233
Utils\esc_cmd( $command, DB_NAME ),
235234
$assoc_args
236235
);
237236

237+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
238238
WP_CLI::success( 'Database checked.' );
239239
}
240240

@@ -271,14 +271,14 @@ public function optimize( $_, $assoc_args ) {
271271

272272
$command = sprintf( '/usr/bin/env mysqlcheck%s %s', $this->get_defaults_flag_string( $assoc_args ), '%s' );
273273
WP_CLI::debug( "Running shell command: {$command}", 'db' );
274-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
275274

276275
$assoc_args['optimize'] = true;
277276
self::run(
278277
Utils\esc_cmd( $command, DB_NAME ),
279278
$assoc_args
280279
);
281280

281+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
282282
WP_CLI::success( 'Database optimized.' );
283283
}
284284

@@ -315,14 +315,14 @@ public function repair( $_, $assoc_args ) {
315315

316316
$command = sprintf( '/usr/bin/env mysqlcheck%s %s', $this->get_defaults_flag_string( $assoc_args ), '%s' );
317317
WP_CLI::debug( "Running shell command: {$command}", 'db' );
318-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
319318

320319
$assoc_args['repair'] = true;
321320
self::run(
322321
Utils\esc_cmd( $command, DB_NAME ),
323322
$assoc_args
324323
);
325324

325+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
326326
WP_CLI::success( 'Database repaired.' );
327327
}
328328

@@ -361,12 +361,12 @@ public function cli( $_, $assoc_args ) {
361361

362362
$command = sprintf( '/usr/bin/env mysql%s --no-auto-rehash', $this->get_defaults_flag_string( $assoc_args ) );
363363
WP_CLI::debug( "Running shell command: {$command}", 'db' );
364-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
365364

366365
if ( ! isset( $assoc_args['database'] ) ) {
367366
$assoc_args['database'] = DB_NAME;
368367
}
369368

369+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
370370
self::run( $command, $assoc_args );
371371
}
372372

@@ -427,7 +427,6 @@ public function query( $args, $assoc_args ) {
427427

428428
$command = sprintf( '/usr/bin/env mysql%s --no-auto-rehash', $this->get_defaults_flag_string( $assoc_args ) );
429429
WP_CLI::debug( "Running shell command: {$command}", 'db' );
430-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
431430

432431
$assoc_args['database'] = DB_NAME;
433432

@@ -453,6 +452,7 @@ public function query( $args, $assoc_args ) {
453452
$assoc_args['execute'] = $this->get_sql_mode_query( $assoc_args ) . $assoc_args['execute'];
454453
}
455454

455+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
456456
self::run( $command, $assoc_args );
457457
}
458458

@@ -563,7 +563,6 @@ public function export( $args, $assoc_args ) {
563563

564564
$initial_command = sprintf( '/usr/bin/env mysqldump%s ', $this->get_defaults_flag_string( $assoc_args ) );
565565
WP_CLI::debug( "Running initial shell command: {$initial_command}", 'db' );
566-
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
567566

568567
if ( $support_column_statistics ) {
569568
$command = $initial_command . '--skip-column-statistics %s';
@@ -599,6 +598,7 @@ public function export( $args, $assoc_args ) {
599598
// Remove parameters not needed for SQL run.
600599
unset( $assoc_args['porcelain'] );
601600

601+
WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' );
602602
self::run( $escaped_command, $assoc_args );
603603

604604
if ( $porcelain ) {
@@ -1003,7 +1003,7 @@ public function size( $args, $assoc_args ) {
10031003
}
10041004

10051005
if ( ! empty( $size_format ) && ! $tables && ! $format && ! $human_readable && true !== $all_tables && true !== $all_tables_with_prefix ) {
1006-
WP_CLI::Line( filter_var( $rows[0]['Size'], FILTER_SANITIZE_NUMBER_INT ) );
1006+
WP_CLI::line( filter_var( $rows[0]['Size'], FILTER_SANITIZE_NUMBER_INT ) );
10071007
} else {
10081008
// Display the rows.
10091009
$args = [
@@ -1471,6 +1471,8 @@ protected function run_query( $query, $assoc_args = [] ) {
14711471
// Ensure that the SQL mode is compatible with WPDB.
14721472
$query = $this->get_sql_mode_query( $assoc_args ) . $query;
14731473

1474+
WP_CLI::debug( "Query: {$query}", 'db' );
1475+
14741476
self::run(
14751477
sprintf(
14761478
'/usr/bin/env mysql%s --no-auto-rehash',

0 commit comments

Comments
 (0)