22
33use WP_CLI \Formatter ;
44use WP_CLI \Utils ;
5+ use cli \table \Column ;
56
67require_once __DIR__ . '/DB_Command_SQLite.php ' ;
78
@@ -293,6 +294,12 @@ public function check( $_, $assoc_args ) {
293294 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
294295
295296 $ assoc_args ['check ' ] = true ;
297+
298+ // Pass --silent to mysqlcheck when in quiet mode.
299+ if ( WP_CLI ::get_config ( 'quiet ' ) ) {
300+ $ assoc_args ['silent ' ] = true ;
301+ }
302+
296303 self ::run (
297304 Utils \esc_cmd ( $ command , DB_NAME ),
298305 $ assoc_args
@@ -348,6 +355,12 @@ public function optimize( $_, $assoc_args ) {
348355 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
349356
350357 $ assoc_args ['optimize ' ] = true ;
358+
359+ // Pass --silent to mysqlcheck when in quiet mode.
360+ if ( WP_CLI ::get_config ( 'quiet ' ) ) {
361+ $ assoc_args ['silent ' ] = true ;
362+ }
363+
351364 self ::run (
352365 Utils \esc_cmd ( $ command , DB_NAME ),
353366 $ assoc_args
@@ -403,6 +416,12 @@ public function repair( $_, $assoc_args ) {
403416 WP_CLI ::debug ( "Running shell command: {$ command }" , 'db ' );
404417
405418 $ assoc_args ['repair ' ] = true ;
419+
420+ // Pass --silent to mysqlcheck when in quiet mode.
421+ if ( WP_CLI ::get_config ( 'quiet ' ) ) {
422+ $ assoc_args ['silent ' ] = true ;
423+ }
424+
406425 self ::run (
407426 Utils \esc_cmd ( $ command , DB_NAME ),
408427 $ assoc_args
@@ -1308,7 +1327,6 @@ public function size( $args, $assoc_args ) {
13081327 if ( ! empty ( $ size_format ) && ! $ tables && ! $ format && ! $ human_readable && true !== $ all_tables && true !== $ all_tables_with_prefix ) {
13091328 WP_CLI ::line ( str_replace ( " {$ size_format_display }" , '' , $ rows [0 ]['Size ' ] ) );
13101329 } else {
1311-
13121330 // Sort the rows by user input
13131331 if ( $ orderby ) {
13141332 usort (
@@ -1329,7 +1347,8 @@ function ( $a, $b ) use ( $order, $orderby ) {
13291347
13301348 // Display the rows.
13311349 $ args = [
1332- 'format ' => $ format ,
1350+ 'format ' => $ format ,
1351+ 'alignments ' => [ 'Size ' => Column::ALIGN_RIGHT ],
13331352 ];
13341353
13351354 $ formatter = new Formatter ( $ args , $ fields );
@@ -1930,7 +1949,7 @@ private static function run( $cmd, $assoc_args = [], $send_to_shell = true, $int
19301949 $ required ['default-character-set ' ] = constant ( 'DB_CHARSET ' );
19311950 }
19321951
1933- // Using 'dbuser' as option name to workaround clash with WP-CLI's global WP 'user' parameter, with 'dbpass' also available for tidyness .
1952+ // Using 'dbuser' as option name to workaround clash with WP-CLI's global WP 'user' parameter, with 'dbpass' also available for tidiness .
19341953 if ( isset ( $ assoc_args ['dbuser ' ] ) ) {
19351954 $ required ['user ' ] = $ assoc_args ['dbuser ' ];
19361955 unset( $ assoc_args ['dbuser ' ] );
0 commit comments