| | |
| | | |
| | | $sql = "SELECT domain_id, domain, document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id']; |
| | | $records = $app->db->queryAllRecords($sql); |
| | | $app->uses('system'); |
| | | if(is_array($records)) { |
| | | foreach($records as $rec){ |
| | | $tmp_path = realpath(escapeshellcmd($rec['document_root'].'/tmp')); |
| | |
| | | chmod(escapeshellcmd($backup_dir), $backup_dir_permissions); |
| | | } |
| | | |
| | | //* mount backup directory, if necessary |
| | | $run_backups = true; |
| | | $server_config['backup_dir_mount_cmd'] = trim($server_config['backup_dir_mount_cmd']); |
| | | if($server_config['backup_dir_is_mount'] == 'y' && $server_config['backup_dir_mount_cmd'] != ''){ |
| | | if(!$app->system->is_mounted($backup_dir)){ |
| | | exec(escapeshellcmd($server_config['backup_dir_mount_cmd'])); |
| | | sleep(1); |
| | | if(!$app->system->is_mounted($backup_dir)) $run_backups = false; |
| | | } |
| | | } |
| | | |
| | | if($run_backups){ |
| | | $sql = "SELECT * FROM web_domain WHERE server_id = ".$conf['server_id']." AND (type = 'vhost' OR type = 'vhostsubdomain')"; |
| | | $records = $app->db->queryAllRecords($sql); |
| | | if(is_array($records)) { |
| | |
| | | unset($dir_handle); |
| | | |
| | | //* Remove backupdir symlink and create as directory instead |
| | | $app->uses('system'); |
| | | $app->system->web_folder_protection($web_path, false); |
| | | |
| | | if(is_link($web_path.'/backup')) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | //* send email to admin that backup directory could not be mounted |
| | | $global_config = $app->getconf->get_global_config('mail'); |
| | | if($global_config['admin_mail'] != ''){ |
| | | $subject = 'Backup directory '.$backup_dir.' could not be mounted'; |
| | | $message = "Backup directory ".$backup_dir." could not be mounted.\n\nThe command\n\n".$server_config['backup_dir_mount_cmd']."\n\nfailed."; |
| | | mail($global_config['admin_mail'], $subject, $message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |