diff --git a/README.md b/README.md index 79e7c6a2e279c9672c049bea40b35c47f7045fc1..0e0ddd461e30bd9dafe90db257358d1eb5c07e95 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,16 @@ This module is compatible with ISPConfig version 3.1 ## Installation -This module have to be installed on master node in multiserver setup. +This module has to be installed on master node in multiserver setup. - Download this repo as archive, unpack it to `/usr/local/ispconfig/interface/web/` and rename forlder to `wizard` OR clone repo using git `git clone https://git.ispconfig.org/ispconfig/module-wizard.git /usr/local/ispconfig/interface/web/wizard` - Create DB table provided in db.sql file `mysql -u root -p < db.sql` - Enable module in user interface System -> CP Users -> Admin user -> Check "wizard" and save. - If it doesn't work, enable module manually by editing admin user in DB table `sys_user` column `modules` - + +On a slave server you only have to create the database table using the instructions above. + ## Planned features - Export results as PDF diff --git a/db.sql b/db.sql index 59177d9f5bd0d36ab5427a895cb592bc59dfd671..534746551625e16d1f978434a2aabf5f7e7b20ed 100644 --- a/db.sql +++ b/db.sql @@ -102,3 +102,16 @@ CREATE TABLE `wizard_template` ( `delete_unused_jailkit` enum('n','y') NOT NULL DEFAULT 'n', PRIMARY KEY (`template_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +ALTER TABLE `wizard_template` + ADD COLUMN `proxy_protocol` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `log_retention`; + +ALTER TABLE `wizard_template` + ADD COLUMN `server_php_id` int(11) UNSIGNED NOT NULL DEFAULT 0; + +ALTER TABLE `wizard_template` ADD `jailkit_chroot_app_sections` mediumtext NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `jailkit_chroot_app_programs` mediumtext NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `delete_unused_jailkit` enum('n','y') NOT NULL DEFAULT 'n'; +ALTER TABLE `wizard_template` ADD `last_jailkit_update` date NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `last_jailkit_hash` varchar(255) DEFAULT NULL; + diff --git a/db_update_3.2.sql b/db_update_3.2.sql index 1c564760830c1cac5bf2805cfc5527fa0578a28c..027f9c649912185890ced983ed6f74ac4c7d8c4d 100644 --- a/db_update_3.2.sql +++ b/db_update_3.2.sql @@ -19,3 +19,19 @@ ALTER TABLE `wizard_template` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEF -- end of backup encryption ALTER TABLE `wizard_template` ADD `backup_excludes` mediumtext DEFAULT NULL AFTER `backup_password`; + +ALTER TABLE `wizard_template` ADD `jailkit_chroot_app_sections` mediumtext NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `jailkit_chroot_app_programs` mediumtext NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `delete_unused_jailkit` enum('n','y') NOT NULL DEFAULT 'n'; +ALTER TABLE `wizard_template` ADD `last_jailkit_update` date NULL DEFAULT NULL; +ALTER TABLE `wizard_template` ADD `last_jailkit_hash` varchar(255) DEFAULT NULL; + +-- Match incremental/upd_0091.sql +ALTER TABLE `wizard_template` ALTER pm SET DEFAULT 'ondemand'; +ALTER TABLE `wizard_template` DROP COLUMN `enable_spdy`; +ALTER TABLE `wizard_template` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`; +ALTER TABLE `wizard_template` CHANGE `apache_directives` `apache_directives` mediumtext NULL DEFAULT NULL; +ALTER TABLE `wizard_template` CHANGE `nginx_directives` `nginx_directives` mediumtext NULL DEFAULT NULL; + +-- Match incremental/upd_0092.sql +ALTER TABLE `wizard_template` DROP COLUMN `fastcgi_php_version`; diff --git a/form/new_service.tform.php b/form/new_service.tform.php index aed530f350a1030de21bd14d717dedeeb1fd3a77..9d42a8b3aecb12993a45fc59abae3cdde8845b1f 100644 --- a/form/new_service.tform.php +++ b/form/new_service.tform.php @@ -252,7 +252,7 @@ $form["tabs"]['client'] = array( 'dns' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', - 'default' => 'y', + 'default' => 'n', 'value' => array(0 => 'n', 1 => 'y') ), 'dns_template_id' => array( diff --git a/new_service.php b/new_service.php index c1243aa68b79c09fd1f071e35d6dd0a074f5a18b..176c378f9a055069015a828c2b28099f3ce894c6 100644 --- a/new_service.php +++ b/new_service.php @@ -83,10 +83,21 @@ class page_action extends tform_actions { global $app, $conf; $fields = $app->tform->encode($this->dataRecord, $app->tform->getCurrentTab(), true); + $client_domain_exists = FALSE; // check for domain unique name - if($app->db->queryOneRecord('SELECT domain_id FROM domain WHERE domain = "'.$fields['domain'].'"')) { - $app->tform->errorMessage = $app->tform->wordbook['domain_error_unique']; + if($app->db->queryOneRecord('SELECT domain_id FROM domain WHERE domain = ?', $fields['domain'])) { + $client_domain_exists = TRUE; + // Check use as web domain. + if($app->db->queryOneRecord('SELECT domain_id FROM web_domain WHERE domain = ?', $fields['domain'])) { + $app->tform->errorMessage = $app->tform->wordbook['domain_error_unique'] . 'b'; + } + elseif($fields['mail'] && $app->db->queryOneRecord('SELECT domain_id FROM mail_domain WHERE domain = ?', $fields['domain'])) { + $app->tform->errorMessage = $app->tform->wordbook['domain_error_unique']. 'a'; + } + else { + // Exists as client domain, not with a website. + } } if($app->tform->errorMessage) @@ -114,7 +125,9 @@ class page_action extends tform_actions { $client_group_id = $res['groupid']; // add domain - $domain_id = $remote->insert_query('../client/form/domain.tform.php', $fields['client_id'], array('domain' => $fields['domain'])); + if (!$client_domain_exists) { + $domain_id = $remote->insert_query('../client/form/domain.tform.php', $fields['client_id'], array('domain' => $fields['domain'])); + } $min_password_length = 8; if(isset($server_config_array['misc']['min_password_length'])) $min_password_length = $server_config_array['misc']['min_password_length']; @@ -500,7 +513,7 @@ class page_action extends tform_actions { 'server_id' => $template['web_server_id'], 'parent_domain_id' => $site_id, 'username' => $client_ftp_prefix . $generated_username, - 'username_prefix' => $client_prefix, + 'username_prefix' => $client_ftp_prefix, 'password' => $app->auth->get_random_password($min_password_length, true), 'quota_size' => $template['hd_quota'], 'dir' => $site_data['document_root'], @@ -537,7 +550,7 @@ class page_action extends tform_actions { 'shell' => $template['shell'], 'active' => 'y', 'username' => $client_shell_prefix . $generated_username, - 'username_prefix' => $client_prefix, + 'username_prefix' => $client_shell_prefix, ); // username, password @@ -550,7 +563,8 @@ class page_action extends tform_actions { $remote->insert_query('../sites/form/shell_user.tform.php', $fields['client_id'], $ssh_params); } - $dbserver = $app->db->queryOneRecord("SELECT server_name FROM server WHERE web_server = 1 AND server_id = ?", $template['database_server_id']); + $dbserver = $app->db->queryOneRecord("SELECT server_name FROM server WHERE web_server = 1 AND server_id = ?", $template['database_server_id']); + $webserver = $app->db->queryOneRecord("SELECT server_name FROM server WHERE web_server = 1 AND server_id = ?", $template['web_server_id']); $global_config = $app->getconf->get_global_config('sites'); $phpmyadmin_url = $global_config['phpmyadmin_url']; @@ -580,7 +594,7 @@ class page_action extends tform_actions {