From 668fbf8108c234677b56c549ac287830a1f42bfa Mon Sep 17 00:00:00 2001 From: Philipp Kitzberger Date: Tue, 26 Sep 2017 12:45:31 +0200 Subject: [PATCH] Add --defaults-file option to mysql/mysqldump --- Documentation/Examples/clisync.yml | 2 ++ .../CliTools/Console/Command/Sync/AbstractCommand.php | 11 +++++++++++ src/conf/clisync.yml | 2 ++ 3 files changed, 15 insertions(+) diff --git a/Documentation/Examples/clisync.yml b/Documentation/Examples/clisync.yml index 59829ac..37cf715 100644 --- a/Documentation/Examples/clisync.yml +++ b/Documentation/Examples/clisync.yml @@ -158,6 +158,8 @@ sync: mysql: username: typo3 password: loremipsum + #hostname: db.example.com + #defaultsFile: /var/www/.my-custom.cnf # List of databases for synchronization # examples: diff --git a/src/app/CliTools/Console/Command/Sync/AbstractCommand.php b/src/app/CliTools/Console/Command/Sync/AbstractCommand.php index de416c5..d7e95a8 100644 --- a/src/app/CliTools/Console/Command/Sync/AbstractCommand.php +++ b/src/app/CliTools/Console/Command/Sync/AbstractCommand.php @@ -997,6 +997,12 @@ protected function wrapRemoteCommand(CommandBuilderInterface $command) protected function createRemoteMySqlCommand($database = null) { $command = new RemoteCommandBuilder('mysql'); + + // Add defaults-file + if ($this->contextConfig->exists('mysql.defaultsFile')) { + $command->addArgumentRaw($this->contextConfig->get('mysql.defaultsFile')); + } + $command // batch mode ->addArgument('-B') @@ -1091,6 +1097,11 @@ protected function createRemoteMySqlDumpCommand($database = null) { $command = new RemoteCommandBuilder('mysqldump'); + // Add defaults-file + if ($this->contextConfig->exists('mysql.defaultsFile')) { + $command->addArgumentRaw($this->contextConfig->get('mysql.defaultsFile')); + } + // Add username if ($this->contextConfig->exists('mysql.username')) { $command->addArgumentTemplate('-u%s', $this->contextConfig->get('mysql.username')); diff --git a/src/conf/clisync.yml b/src/conf/clisync.yml index 20faf0f..f7cac4d 100644 --- a/src/conf/clisync.yml +++ b/src/conf/clisync.yml @@ -159,6 +159,8 @@ sync: mysql: username: typo3 password: loremipsum + #hostname: db.example.com + #defaultsFile: /var/www/.my-custom.cnf # List of databases for synchronization # examples: