Change database structure to support multistack, #581

This commit is contained in:
Tilman Klaeger (tilman19) 2012-12-02 15:12:10 +01:00 committed by Michael Kaufmann (d00p)
parent fe638b5f52
commit 0ba04fbe42
2 changed files with 58 additions and 3 deletions

View File

@ -539,7 +539,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'allow_theme_change_admin', '1'),
('panel', 'allow_theme_change_customer', '1'),
('panel', 'version', '0.9.29-dev3');
('panel', 'version', '0.9.29-dev4');
@ -750,7 +750,6 @@ INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`
(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 16M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n');
DROP TABLE IF EXISTS `aps_instances`;
CREATE TABLE IF NOT EXISTS `aps_instances` (
`ID` int(4) NOT NULL auto_increment,
@ -917,3 +916,12 @@ CREATE TABLE IF NOT EXISTS `domain_docrootsettings` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_domaintoip`;
CREATE TABLE IF NOT EXISTS `panel_domaintoip` (
`id_domain` int(11) unsigned NOT NULL,
`id_ipandports` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_domain`,`id_ipandports`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;

View File

@ -1985,7 +1985,7 @@ if(isFroxlorVersion('0.9.28-svn4')) {
updateToVersion('0.9.28-svn5');
}
if(isFroxlorVersion('0.9.28-svn5')) {
if (isFroxlorVersion('0.9.28-svn5')) {
showUpdateStep("Updating from 0.9.28-svn5 to 0.9.28-svn6", true);
lastStepStatus(0);
@ -2109,3 +2109,50 @@ if (isFroxlorVersion('0.9.29-dev2')) {
updateToVersion('0.9.29-dev3');
}
if (isFroxlorVersion('0.9.29-dev3')) {
showUpdateStep("Updating from 0.9.29-dev3 to 0.9.29-dev4", false);
showUpdateStep("Adding new ip to domain - mapping-table");
$db->query("DROP TABLE IF EXISTS `panel_domaintoip`;");
$sql = "CREATE TABLE `".TABLE_DOMAINTOIP."` (
`id_domain` int(11) unsigned NOT NULL,
`id_ipandports` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_domain`, `id_ipandports`)
) ENGINE=MyISAM ;";
$db->query($sql);
lastStepStatus(0);
showUpdateStep("Convert old domain to ip - mappings");
$result = $db->query("SELECT `id`, `ipandport`, `ssl_ipandport`, `ssl_redirect`, `parentdomainid` FROM `" . TABLE_PANEL_DOMAINS . "`;");
while ($row = $db->fetch_array($result)) {
if ((int)$row['ipandport'] != 0) {
$db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET
`id_domain` = " . (int)$row['id'] . ",
`id_ipandports` = " . (int)$row['ipandport']);
}
if ((int)$row['ssl_ipandport'] != 0) {
$db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET
`id_domain` = " . (int)$row['id'] . ",
`id_ipandports` = " . (int)$row['ssl_ipandport']);
}
// Subdomains also have ssl ports if the parent has
elseif ((int)$row['ssl_ipandport'] == 0 && (int)$row['ssl_redirect'] != 0 && (int)$row['parentdomainid'] != 0) {
$db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET
`id_domain` = " . (int)$row['id'] . ",
`id_ipandports` = (SELECT `ssl_ipandport` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id` = '".(int)$row['parentdomainid']."');");
}
}
lastStepStatus(0);
showUpdateStep("Updating table layouts");
$db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ipandport`;");
$db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl`;");
$db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` DROP `ssl_ipandport`;");
lastStepStatus(0);
updateToVersion('0.9.28-svn6');
}