Total Complexity | 7 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | class MysqlProcessor extends DbProcessor |
||
11 | { |
||
12 | |||
13 | public function init() |
||
14 | { |
||
15 | $this->port = $this->port ?: 3306; |
||
16 | } |
||
17 | |||
18 | public function backup() |
||
19 | { |
||
20 | $mysqldumpPath = $this->module->binaries['mysqldump']; |
||
21 | $gzipPath = $this->module->binaries['gzip']; |
||
22 | $ionicePath = $this->module->binaries['ionice']; |
||
23 | $this->checkBinary($mysqldumpPath); |
||
24 | $this->checkBinary($gzipPath); |
||
25 | $this->checkBinary($ionicePath); |
||
26 | $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}"; |
||
27 | (exec($command)); |
||
28 | if (!file_exists($this->backupFilePath) || filesize($this->backupFilePath) < 100) |
||
29 | throw new MysqlDumpException(); |
||
30 | } |
||
31 | |||
32 | public function restore() |
||
42 | } |
||
43 | } |
||
44 |