| | |
| | | if($backup_mode == '') $backup_mode = 'userzip'; |
| | | |
| | | if($backup_dir != '') { |
| | | //* mount backup directory, if necessary |
| | | $run_backups = true; |
| | | $backup_dir_mount_cmd = '/usr/local/ispconfig/server/scripts/backup_dir_mount.sh'; |
| | | if( $server_config['backup_dir_is_mount'] == 'y' && |
| | | is_file($backup_dir_mount_cmd) && |
| | | is_executable($backup_dir_mount_cmd) && |
| | | fileowner($backup_dir_mount_cmd) === 0 |
| | | ){ |
| | | if(!$app->system->is_mounted($backup_dir)){ |
| | | exec($backup_dir_mount_cmd); |
| | | sleep(1); |
| | | if(!$app->system->is_mounted($backup_dir)) $run_backups = false; |
| | | } |
| | | } |
| | | //* mount backup directory, if necessary |
| | | if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $run_backups = false; |
| | | |
| | | $records = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE server_id = ? AND maildir <> ''", intval($conf['server_id'])); |
| | | |
| | |
| | | foreach($records as $rec) { |
| | | //* Do the mailbox backup |
| | | if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) { |
| | | $email = $rec['email']; |
| | | $email=explode("@",$email)[1]; |
| | | $domain_rec=$app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = ?", $email); |
| | | unset($email); |
| | | $temp = explode("@",$email); |
| | | $domain = $temp[1]; |
| | | unset($temp);; |
| | | $domain_rec=$app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = ?", $domain); |
| | | |
| | | $mail_backup_dir = $backup_dir.'/mail'.$domain_rec['domain_id']; |
| | | if(!is_dir($mail_backup_dir)) mkdir($mail_backup_dir, 0750); |