Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function createBackup() |
||
21 | { |
||
22 | $current_date = date('Y-m-d_H-i-s'); |
||
23 | $backup_file = $this->database.'_'.$current_date.'.sql.gz'; |
||
24 | |||
25 | // If mysqldump is on the system path you do not need to specify the full path |
||
26 | $mysqldump = "mysqldump --databases --host=$this->host --user=$this->username "; |
||
27 | |||
28 | if ($this->password) { |
||
29 | $mysqldump .= '--password='.$this->password.' '; |
||
30 | } |
||
31 | |||
32 | $mysqldump .= $this->database; |
||
33 | $mysqldump .= ' | gzip > '.$backup_file; |
||
34 | |||
35 | // Execute command using system() |
||
36 | system($mysqldump); |
||
37 | |||
38 | return $backup_file; |
||
39 | } |
||
40 | } |
||
41 |