Skip to content

Commit

Permalink
Provide possibility to turn off backup parameters (#2)
Browse files Browse the repository at this point in the history
- introduced new setting named use-backup-parameters
  • Loading branch information
bua89 authored Nov 20, 2021
1 parent 351a7e9 commit 78a0207
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public function __construct(
'skip-comments' => false,
'skip-dump-date' => false,
'skip-definer' => false,
'use-backup-parameters' => true,
'where' => '',
/* deprecated */
'disable-foreign-keys-check' => true
Expand Down Expand Up @@ -419,9 +420,11 @@ public function start($filename = '')
$this->compressManager->write($this->getDumpFileHeader());

// Store server settings and use sanner defaults to dump
$this->compressManager->write(
$this->typeAdapter->backup_parameters()
);
if (true === $this->dumpSettings['use-backup-parameters']) {
$this->compressManager->write(
$this->typeAdapter->backup_parameters()
);
}

if ($this->dumpSettings['databases']) {
$this->compressManager->write(
Expand Down Expand Up @@ -466,9 +469,12 @@ public function start($filename = '')
$this->exportEvents();

// Restore saved parameters.
$this->compressManager->write(
$this->typeAdapter->restore_parameters()
);
if (true === $this->dumpSettings['use-backup-parameters']) {
$this->compressManager->write(
$this->typeAdapter->restore_parameters()
);
}

// Write some stats to output file.
$this->compressManager->write($this->getDumpFileFooter());
// Close output file.
Expand Down

0 comments on commit 78a0207

Please sign in to comment.