@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | $ionicePath = $this->module->binaries['ionice']; |
20 | 20 | $command = "PGPASSWORD='{$this->password}' {$ionicePath} -c{$this->io} {$binaryPath} -h {$this->host} -p {$this->port} -U {$this->username} -Fc -Z1 {$this->database} -f {$this->backupFilePath}"; |
21 | 21 | exec($command, $return); |
22 | - if (!empty($return)) |
|
23 | - throw new PostgresDumpException(); |
|
22 | + if (!empty($return)) { |
|
23 | + throw new PostgresDumpException(); |
|
24 | + } |
|
24 | 25 | } |
25 | 26 | |
26 | 27 | public function restore(array $tableNames = []): void |
@@ -28,8 +29,9 @@ discard block |
||
28 | 29 | $binaryPath = $this->module->binaries['pg_restore']; |
29 | 30 | $command = "PGPASSWORD='{$this->password}' {$binaryPath} -c -Fc -j 4 -h {$this->host} -p {$this->port} -U {$this->username} -d {$this->database} {$this->backupFilePath}"; |
30 | 31 | exec($command, $return); |
31 | - if (!empty($return)) |
|
32 | - throw new PostgresDumpException(); |
|
32 | + if (!empty($return)) { |
|
33 | + throw new PostgresDumpException(); |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | |
35 | 37 | public function init() |
@@ -56,13 +56,15 @@ |
||
56 | 56 | $dsn = substr($dsn, strpos($dsn, ':') + 1); |
57 | 57 | $dsnParts = explode(';', $dsn); |
58 | 58 | |
59 | - if (empty($dsnParts)) |
|
60 | - throw new DsnParseException(); |
|
59 | + if (empty($dsnParts)) { |
|
60 | + throw new DsnParseException(); |
|
61 | + } |
|
61 | 62 | |
62 | 63 | foreach ($dsnParts as $part) { |
63 | 64 | $row = explode('=', $part); |
64 | - if (isset($row[0]) && isset($row[1])) |
|
65 | - $this->parsedDsn[$row[0]] = $row[1]; |
|
65 | + if (isset($row[0]) && isset($row[1])) { |
|
66 | + $this->parsedDsn[$row[0]] = $row[1]; |
|
67 | + } |
|
66 | 68 | } |
67 | 69 | |
68 | 70 | $this->host = $this->parsedDsn['host'] ?: null; |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $this->checkBinary($ionicePath); |
23 | 23 | $command = "{$ionicePath} -c{$this->io} {$mysqldumpPath} -h {$this->host} -P {$this->port} -u {$this->username} -p{$this->password} {$this->database} | {$gzipPath} -9 -c > {$this->backupFilePath}"; |
24 | 24 | (exec($command)); |
25 | - if (!file_exists($this->backupFilePath) || filesize($this->backupFilePath) < 100) |
|
26 | - throw new MysqlDumpException(); |
|
25 | + if (!file_exists($this->backupFilePath) || filesize($this->backupFilePath) < 100) { |
|
26 | + throw new MysqlDumpException(); |
|
27 | + } |
|
27 | 28 | } |
28 | 29 | |
29 | 30 | public function restore(array $tableNames = []): void |
@@ -34,7 +35,8 @@ discard block |
||
34 | 35 | $this->checkBinary($mysqlPath); |
35 | 36 | $command = "{$zcatPath} {$this->backupFilePath} | {$mysqlPath} -h {$this->host} -P {$this->port} -u {$this->username} -p{$this->password} {$this->database}"; |
36 | 37 | exec($command, $return); |
37 | - if (!empty($return)) |
|
38 | - throw new PostgresDumpException(); |
|
38 | + if (!empty($return)) { |
|
39 | + throw new PostgresDumpException(); |
|
40 | + } |
|
39 | 41 | } |
40 | 42 | } |