Skip to content

Commit b9124cc

Browse files
author
Marius Burkard
committed
Merge branch '5870-3-2-sql-updates-not-complete' into 'develop'
Resolve "3.2 sql updates not complete" Closes #5870 See merge request ispconfig/ispconfig3!1326
2 parents b86c2c7 + 4a4c572 commit b9124cc

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

install/lib/update.lib.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ function updateDbAndIni() {
185185
else $next_db_version = intval($current_db_version + 1);
186186
$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
187187
$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
188-
188+
189189
// comma separated list of version numbers were a update has to be done silently
190-
$silent_update_versions = 'dev_collection,75';
190+
$silent_update_versions = 'dev_collection,75,91';
191191

192192
if(is_file($sql_patch_filename)) {
193193

@@ -214,14 +214,14 @@ function updateDbAndIni() {
214214
} else {
215215
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
216216
}
217-
217+
218218
if(in_array($next_db_version,explode(',',$silent_update_versions))) {
219219
$cmd .= ' > /dev/null 2> /dev/null';
220220
} else {
221221
$cmd .= ' >> /var/log/ispconfig_install.log 2>> /var/log/ispconfig_install.log';
222222
}
223223
system($cmd);
224-
224+
225225
swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
226226

227227
//* Exec onAfterSQL function
@@ -231,7 +231,7 @@ function updateDbAndIni() {
231231

232232
if($dev_patch == false) $current_db_version = $next_db_version;
233233
else $found = false;
234-
234+
235235
if(isset($php_patch)) unset($php_patch);
236236
} elseif($dev_patch == false) {
237237
$dev_patch = true;
@@ -416,7 +416,7 @@ function updateDbAndIni() {
416416

417417
function setDefaultServers(){
418418
global $inst, $conf;
419-
419+
420420
// clients
421421
$clients = $inst->db->queryAllRecords("SELECT * FROM ".$conf["mysql"]["database"].".client");
422422
if(is_array($clients) && !empty($clients)){
@@ -431,7 +431,7 @@ function setDefaultServers(){
431431
if(trim($client['db_servers']) == '') $inst->db->query("UPDATE ?? SET db_servers = ? WHERE client_id = ?", $conf["mysql"]["database"].".client", trim($client['default_dbserver']), $client['client_id']);
432432
}
433433
}
434-
434+
435435
}
436436

437437

@@ -442,13 +442,13 @@ function setDefaultServers(){
442442
*/
443443
function check_service_config_state($servicename, $detected_value) {
444444
global $current_svc_config, $inst, $conf;
445-
445+
446446
if ($current_svc_config[$servicename] == 1) $current_state = 1;
447447
else $current_state = 0;
448448

449449
if ($detected_value) $detected_value = 1;
450450
else $detected_value = 0;
451-
451+
452452
if ($detected_value != $current_state) {
453453
$answer = $inst->simple_query('Service \''.$servicename.'\' '.($detected_value ? 'has been' : 'has not been').' detected ('.($current_state ? 'strongly recommended, currently enabled' : 'currently disabled').') do you want to '.($detected_value ? 'enable and configure' : 'disable').' it? ', array('yes', 'no'), ($current_state ? 'yes' : 'no'), 'svc_detect_change_'.$servicename);
454454
if ($answer == 'yes') return $detected_value;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- we need those to fix some installations failing in 0089 and 0090
2+
ALTER TABLE `web_domain` ROW_FORMAT=DYNAMIC;
3+
ALTER TABLE `mail_user` ROW_FORMAT=DYNAMIC;
4+
ALTER TABLE `web_domain` ADD COLUMN `proxy_protocol` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `log_retention`;
5+
ALTER TABLE `web_domain` ADD `backup_format_web` VARCHAR( 255 ) NOT NULL default 'default' AFTER `backup_copies`;
6+
ALTER TABLE `web_domain` ADD `backup_format_db` VARCHAR( 255 ) NOT NULL default 'gzip' AFTER `backup_format_web`;
7+
ALTER TABLE `web_domain` ADD `backup_encrypt` enum('n','y') NOT NULL DEFAULT 'n' AFTER `backup_format_db`;
8+
ALTER TABLE `web_domain` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `backup_encrypt`;
9+
ALTER TABLE `web_backup` ADD `backup_format` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `backup_mode`;
10+
ALTER TABLE `web_backup` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `filesize`;
11+
ALTER TABLE `web_domain` ALTER pm SET DEFAULT 'ondemand';
12+
ALTER TABLE `web_domain` DROP COLUMN `enable_spdy`;
13+
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;
14+
ALTER TABLE `web_domain` ADD `server_php_id` INT(11) UNSIGNED NOT NULL DEFAULT 0;
15+
ALTER TABLE `web_domain` CHANGE `apache_directives` `apache_directives` mediumtext NULL DEFAULT NULL;
16+
ALTER TABLE `web_domain` CHANGE `nginx_directives` `nginx_directives` mediumtext NULL DEFAULT NULL;
17+
UPDATE `web_domain` as w LEFT JOIN sys_group as g ON (g.groupid = w.sys_groupid) INNER JOIN `server_php` as p ON (w.fastcgi_php_version = CONCAT(p.name, ':', p.php_fastcgi_binary, ':', p.php_fastcgi_ini_dir) AND p.server_id IN (0, w.server_id) AND p.client_id IN (0, g.client_id)) SET w.server_php_id = p.server_php_id, w.fastcgi_php_version = '' WHERE w.server_php_id = 0;
18+
UPDATE `web_domain` as w LEFT JOIN sys_group as g ON (g.groupid = w.sys_groupid) INNER JOIN `server_php` as p ON (w.fastcgi_php_version = CONCAT(p.name, ':', p.php_fpm_init_script, ':', p.php_fpm_ini_dir, ':', p.php_fpm_pool_dir) AND p.server_id IN (0, w.server_id) AND p.client_id IN (0, g.client_id)) SET w.server_php_id = p.server_php_id, w.fastcgi_php_version = '' WHERE w.server_php_id = 0;
19+
ALTER TABLE `mail_user` ADD `forward_in_lda` enum('n','y') NOT NULL default 'n' AFTER `cc`;
20+
-- end of fixes
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
-- drop old php column because new installations don't have them (fails in multi-server)
2+
ALTER TABLE `web_domain` DROP COLUMN `fastcgi_php_version`;

install/sql/ispconfig3.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,7 @@ CREATE TABLE `web_domain` (
20912091
`last_jailkit_hash` varchar(255) DEFAULT NULL,
20922092
PRIMARY KEY (`domain_id`),
20932093
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
2094-
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2094+
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
20952095

20962096
-- --------------------------------------------------------
20972097

0 commit comments

Comments
 (0)