Skip to content

Commit 435f2e6

Browse files
committed
Adapt options in import()
1 parent 1de14eb commit 435f2e6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/DB_Command.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,12 @@ public function import( $args, $assoc_args ) {
714714
$result_file = sprintf( '%s.sql', DB_NAME );
715715
}
716716

717-
$mysql_args = [
718-
'database' => DB_NAME,
719-
];
717+
// Process options to MySQL.
718+
$mysql_args = array_merge(
719+
[ 'database' => DB_NAME ],
720+
self::get_mysql_args( $assoc_args ),
721+
self::get_dbuser_dbpass_args( $assoc_args )
722+
);
720723

721724
if ( '-' !== $result_file ) {
722725
if ( ! is_readable( $result_file ) ) {
@@ -733,8 +736,6 @@ public function import( $args, $assoc_args ) {
733736
} else {
734737
$result_file = 'STDIN';
735738
}
736-
// Check if any mysql option pass.
737-
$mysql_args = array_merge( $mysql_args, self::get_mysql_args( $assoc_args ) );
738739

739740
$command = sprintf( '/usr/bin/env mysql%s --no-auto-rehash', $this->get_defaults_flag_string( $assoc_args ) );
740741
WP_CLI::debug( "Running shell command: {$command}", 'db' );

0 commit comments

Comments
 (0)