From 2e4e4272fe6cc4d6db0b233b10bfbdc394ca9c48 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Fri, 30 Nov 2018 14:42:37 +0100 Subject: [PATCH] Use cnf file for restore command --- Database/MySQL.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Database/MySQL.php b/Database/MySQL.php index 7b49a74..f90d531 100644 --- a/Database/MySQL.php +++ b/Database/MySQL.php @@ -147,7 +147,9 @@ public function dump() */ public function restore() { + $this->prepareEnvironment(); $this->execute($this->getRestoreCommand()); + $this->removeConfigurationFile(); } /** @@ -172,19 +174,8 @@ protected function getRestoreCommand() throw InvalidConfigurationException::create('$restoreFolder'); } - $restoreAuth = ''; - if ($this->params['db_user']) { - $restoreAuth = sprintf('-u%s', $this->params['db_user']); - - if ($this->params['db_password']) { - $restoreAuth = $restoreAuth . sprintf(" --password=\"%s\"", $this->params['db_password']); - } - } - - $this->prepareFileName(); - $command = sprintf('mysql %s %s < %s', - $restoreAuth, + $this->auth, $this->params['database'], ProcessUtils::escapeArgument(sprintf('%smysql/%s', $this->restoreFolder, $this->fileName)) );