Commit b9124cc5 authored by Marius Burkard's avatar Marius Burkard

Merge branch '5870-3-2-sql-updates-not-complete' into 'develop'

Resolve "3.2 sql updates not complete"

Closes #5870

See merge request !1326
parents b86c2c74 4a4c572c
Pipeline #6524 passed with stage
in 16 seconds
...@@ -185,9 +185,9 @@ function updateDbAndIni() { ...@@ -185,9 +185,9 @@ function updateDbAndIni() {
else $next_db_version = intval($current_db_version + 1); else $next_db_version = intval($current_db_version + 1);
$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql'; $sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php'; $php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
// comma separated list of version numbers were a update has to be done silently // comma separated list of version numbers were a update has to be done silently
$silent_update_versions = 'dev_collection,75'; $silent_update_versions = 'dev_collection,75,91';
if(is_file($sql_patch_filename)) { if(is_file($sql_patch_filename)) {
...@@ -214,14 +214,14 @@ function updateDbAndIni() { ...@@ -214,14 +214,14 @@ function updateDbAndIni() {
} else { } else {
$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; $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;
} }
if(in_array($next_db_version,explode(',',$silent_update_versions))) { if(in_array($next_db_version,explode(',',$silent_update_versions))) {
$cmd .= ' > /dev/null 2> /dev/null'; $cmd .= ' > /dev/null 2> /dev/null';
} else { } else {
$cmd .= ' >> /var/log/ispconfig_install.log 2>> /var/log/ispconfig_install.log'; $cmd .= ' >> /var/log/ispconfig_install.log 2>> /var/log/ispconfig_install.log';
} }
system($cmd); system($cmd);
swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename); swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
//* Exec onAfterSQL function //* Exec onAfterSQL function
...@@ -231,7 +231,7 @@ function updateDbAndIni() { ...@@ -231,7 +231,7 @@ function updateDbAndIni() {
if($dev_patch == false) $current_db_version = $next_db_version; if($dev_patch == false) $current_db_version = $next_db_version;
else $found = false; else $found = false;
if(isset($php_patch)) unset($php_patch); if(isset($php_patch)) unset($php_patch);
} elseif($dev_patch == false) { } elseif($dev_patch == false) {
$dev_patch = true; $dev_patch = true;
...@@ -416,7 +416,7 @@ function updateDbAndIni() { ...@@ -416,7 +416,7 @@ function updateDbAndIni() {
function setDefaultServers(){ function setDefaultServers(){
global $inst, $conf; global $inst, $conf;
// clients // clients
$clients = $inst->db->queryAllRecords("SELECT * FROM ".$conf["mysql"]["database"].".client"); $clients = $inst->db->queryAllRecords("SELECT * FROM ".$conf["mysql"]["database"].".client");
if(is_array($clients) && !empty($clients)){ if(is_array($clients) && !empty($clients)){
...@@ -431,7 +431,7 @@ function setDefaultServers(){ ...@@ -431,7 +431,7 @@ function setDefaultServers(){
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']); 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']);
} }
} }
} }
...@@ -442,13 +442,13 @@ function setDefaultServers(){ ...@@ -442,13 +442,13 @@ function setDefaultServers(){
*/ */
function check_service_config_state($servicename, $detected_value) { function check_service_config_state($servicename, $detected_value) {
global $current_svc_config, $inst, $conf; global $current_svc_config, $inst, $conf;
if ($current_svc_config[$servicename] == 1) $current_state = 1; if ($current_svc_config[$servicename] == 1) $current_state = 1;
else $current_state = 0; else $current_state = 0;
if ($detected_value) $detected_value = 1; if ($detected_value) $detected_value = 1;
else $detected_value = 0; else $detected_value = 0;
if ($detected_value != $current_state) { if ($detected_value != $current_state) {
$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); $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);
if ($answer == 'yes') return $detected_value; if ($answer == 'yes') return $detected_value;
......
-- we need those to fix some installations failing in 0089 and 0090
ALTER TABLE `web_domain` ROW_FORMAT=DYNAMIC;
ALTER TABLE `mail_user` ROW_FORMAT=DYNAMIC;
ALTER TABLE `web_domain` ADD COLUMN `proxy_protocol` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `log_retention`;
ALTER TABLE `web_domain` ADD `backup_format_web` VARCHAR( 255 ) NOT NULL default 'default' AFTER `backup_copies`;
ALTER TABLE `web_domain` ADD `backup_format_db` VARCHAR( 255 ) NOT NULL default 'gzip' AFTER `backup_format_web`;
ALTER TABLE `web_domain` ADD `backup_encrypt` enum('n','y') NOT NULL DEFAULT 'n' AFTER `backup_format_db`;
ALTER TABLE `web_domain` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `backup_encrypt`;
ALTER TABLE `web_backup` ADD `backup_format` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `backup_mode`;
ALTER TABLE `web_backup` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `filesize`;
ALTER TABLE `web_domain` ALTER pm SET DEFAULT 'ondemand';
ALTER TABLE `web_domain` DROP COLUMN `enable_spdy`;
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;
ALTER TABLE `web_domain` ADD `server_php_id` INT(11) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `web_domain` CHANGE `apache_directives` `apache_directives` mediumtext NULL DEFAULT NULL;
ALTER TABLE `web_domain` CHANGE `nginx_directives` `nginx_directives` mediumtext NULL DEFAULT NULL;
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;
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;
ALTER TABLE `mail_user` ADD `forward_in_lda` enum('n','y') NOT NULL default 'n' AFTER `cc`;
-- end of fixes
\ No newline at end of file
-- drop old php column because new installations don't have them (fails in multi-server)
ALTER TABLE `web_domain` DROP COLUMN `fastcgi_php_version`;
...@@ -2091,7 +2091,7 @@ CREATE TABLE `web_domain` ( ...@@ -2091,7 +2091,7 @@ CREATE TABLE `web_domain` (
`last_jailkit_hash` varchar(255) DEFAULT NULL, `last_jailkit_hash` varchar(255) DEFAULT NULL,
PRIMARY KEY (`domain_id`), PRIMARY KEY (`domain_id`),
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` ) UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment