Skip to content

Commit

Permalink
[database:dump] Don't duplicate .gz extension (#3014)
Browse files Browse the repository at this point in the history
* [database:dump] Don't duplicate .gz extension

* [database:dump] Keep the overwritten file
  • Loading branch information
rpsu authored and jmolivas committed Dec 17, 2016
1 parent ccbf22d commit f08361e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Command/Database/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($this->shellProcess->exec($command, $this->appRoot)) {
$resultFile = $file;
if ($gz) {
$resultFile = $file . ".gz";
if(substr($file, -3) != '.gz') {
$resultFile = $file . ".gz";
}
file_put_contents(
$resultFile,
gzencode(
file_get_contents(
$file)
)
);
unlink($file);
if($resultFile != $file) {
unlink($file);
}
}

$io->success(
Expand Down

0 comments on commit f08361e

Please sign in to comment.