$params = array('server_id' => $server_id, 'ip_address' => '*', 'domain' => $entry['name'], 'type' => 'vhost', 'parent_domain_id' => '', 'vhost_type' => 'name', 'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'disk_space', -1)), 'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'max_traffic', -1)), 'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0), 'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0), 'suexec' => yes_no(1), 'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0, 'subdomain' => 'www', 'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0), 'php' => $phpmode, 'fastcgi_php_version' => '', 'ruby' => yes_no(0), 'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0), 'active' => yes_no($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true' ? 1 : 0), 'redirect_type' => $redir_type, 'redirect_path' => $redir_path, 'seo_redirect' => '', 'ssl_state' => $entry[''], 'ssl_locality' => $entry[''], 'ssl_organisation' => $entry[''], 'ssl_organisation_unit' => $entry[''], 'ssl_country' => $entry[''], 'ssl_domain' => $entry[''], 'ssl_request' => $entry[''], 'ssl_cert' => $entry[''], 'ssl_bundle' => $entry[''], 'ssl_action' => $entry[''], 'stats_password' => '', 'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer', 'backup_interval' => 'none', 'backup_copies' => 1, 'allow_override' => 'All', 'pm_process_idle_timeout' => 10, 'pm_max_requests' => 0); // find already inserted domain $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'"); if (!$old_domain) { $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'"); } if ($old_domain) { $new_id = $old_domain['domain_id']; $msg .= "Found domain with id " . $new_id . ", updating it.<br />"; $params = array_merge($old_domain, $params); $ok = $importer->sites_web_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params); if ($ok === false) { $msg .= " Error: " . $importer->getFault() . "<br />"; } } else { $new_id = $importer->sites_web_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params, true); // read only... } $domain_ids[$entry['id']] = $new_id; $domain_roots[$entry['id']] = $entry['www_root']; $domain_owners[$entry['id']] = $entry['cl_id']; $dns_domain_ids[$entry['dns_zone_id']] = $entry['id']; if ($new_id === false) { //something went wrong here... $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />"; $msg .= " Error: " . $importer->getFault() . "<br />"; } else { $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") inserted -> " . $new_id . ".<br />"; $cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'"); $path = $cmd_data['document_root']; add_command('chattr -i ' . escapeshellarg($path));