Skip to content

Commit 854330e

Browse files
committed
Add --include-tablespaces flag and default to --no-tablespaces
1 parent 226e707 commit 854330e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/DB_Command.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ public function query( $args, $assoc_args ) {
471471
* [--exclude_tables=<tables>]
472472
* : The comma separated list of specific tables that should be skipped from exporting. Excluding this parameter will export all tables in the database.
473473
*
474+
* [--include-tablespaces]
475+
* : Skips adding the default --no-tablespaces option to mysqldump.
476+
*
474477
* [--porcelain]
475478
* : Output filename for the exported database.
476479
*
@@ -552,12 +555,18 @@ public function export( $args, $assoc_args ) {
552555
$initial_command = sprintf( '/usr/bin/env mysqldump%s ', $this->get_defaults_flag_string( $assoc_args ) );
553556
WP_CLI::debug( "Running initial shell command: {$initial_command}", 'db' );
554557

558+
$default_arguments = [ '%s' ];
559+
555560
if ( $support_column_statistics ) {
556-
$command = $initial_command . '--skip-column-statistics %s';
557-
} else {
558-
$command = $initial_command . '%s';
561+
$default_arguments[] = '--skip-column-statistics';
559562
}
560563

564+
if ( ! Utils\get_flag_value( $assoc_args, 'include-tablespaces', false ) ) {
565+
$default_arguments[] = 'no-tablespaces';
566+
}
567+
568+
$command = $initial_command . implode( ' ', $default_arguments );
569+
561570
$command_esc_args = [ DB_NAME ];
562571

563572
if ( isset( $assoc_args['tables'] ) ) {

0 commit comments

Comments
 (0)