diff --git a/src/Databases/MySql.php b/src/Databases/MySql.php index d9fefea..e969983 100644 --- a/src/Databases/MySql.php +++ b/src/Databases/MySql.php @@ -8,6 +8,8 @@ class MySql extends DbDumper { + protected bool $skipSsl = false; + protected bool $skipComments = true; protected bool $useExtendedInserts = true; @@ -42,6 +44,13 @@ public function __construct() $this->port = 3306; } + public function setSkipSsl(bool $skipSsl): self + { + $this->skipSsl = $skipSsl; + + return $this; + } + public function skipComments(): self { $this->skipComments = true; @@ -119,6 +128,8 @@ public function dontUseQuick(): self return $this; } + + public function setDefaultCharacterSet(string $characterSet): self { $this->defaultCharacterSet = $characterSet; @@ -238,7 +249,7 @@ public function getDumpCommand(string $dumpFile, string $temporaryCredentialsFil } if (! empty($this->defaultCharacterSet)) { - $command[] = '--default-character-set='.$this->defaultCharacterSet; + $command[] = '--default-character-set=' . $this->defaultCharacterSet; } foreach ($this->extraOptions as $extraOption) { @@ -246,7 +257,7 @@ public function getDumpCommand(string $dumpFile, string $temporaryCredentialsFil } if ($this->setGtidPurged !== 'AUTO') { - $command[] = '--set-gtid-purged='.$this->setGtidPurged; + $command[] = '--set-gtid-purged=' . $this->setGtidPurged; } if (! $this->dbNameWasSetAsExtraOption) { @@ -270,7 +281,6 @@ public function getDumpCommand(string $dumpFile, string $temporaryCredentialsFil } return $this->echoToFile($finalDumpCommand, $dumpFile); - } public function getContentsOfCredentialsFile(): string @@ -286,6 +296,10 @@ public function getContentsOfCredentialsFile(): string $contents[] = "host = '{$this->host}'"; } + if ($this->skipSsl) { + $contents[] = "skip-ssl"; + } + return implode(PHP_EOL, $contents); }