Reverting the multiserver-stuff, we'll do this inside the branch

This commit is contained in:
Florian Aders (EleRas)
2010-10-23 10:20:23 +00:00
parent 99696ff6cb
commit ad31b07a04
32 changed files with 169 additions and 962 deletions

View File

@@ -1168,132 +1168,3 @@ if(isFroxlorVersion('0.9.14-svn5'))
updateToVersion('0.9.14-svn6');
}
if(isFroxlorVersion('0.9.14-svn6'))
{
showUpdateStep("Updating from 0.9.14-svn6 to 0.9.14-svn7", false);
// remove deprecated realtime-feature
showUpdateStep("Removing realtime-feature (deprecated)");
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'realtime_port';");
lastStepStatus(0);
// remove deprecated panel_navigation
showUpdateStep("Removing table `panel_navigation` (deprecated)");
$db->query("DROP TABLE IF EXISTS `panel_navigation`;");
lastStepStatus(0);
// remove deprecated panel_cronscript
showUpdateStep("Removing table `panel_cronscript` (deprecated)");
$db->query("DROP TABLE IF EXISTS `panel_cronscript`;");
lastStepStatus(0);
// make ticket-system ipv6 compatible
showUpdateStep("Altering IP field in panel_tickets (IPv6 compatibility)");
$db->query("ALTER TABLE `" . TABLE_PANEL_TICKETS . "` MODIFY `ip` varchar(39) NOT NULL default '';");
lastStepStatus(0);
showUpdateStep("Preparing database tables for upcoming multi-server support");
$db->query("ALTER TABLE `".TABLE_PANEL_SETTINGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `value`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `email_autoresponder_used`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` ADD `sid` int(11) NOT NULL default '0' AFTER `iscatchall`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_FTP_USERS."` ADD `sid` int(11) NOT NULL default '0' AFTER `customerid`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_PANEL_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `data`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_APS_TASKS."` ADD `sid` int(11) NOT NULL default '0' AFTER `Task`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_PANEL_LOG."` ADD `sid` int(11) NOT NULL default '0' AFTER `text`;");
showUpdateStep(".");
$db->query("ALTER TABLE `".TABLE_PANEL_PHPCONFIGS."` ADD `sid` int(11) NOT NULL default '0' AFTER `phpsettings`;");
lastStepStatus(0);
showUpdateStep("Adding new table `".TABLE_FROXLOR_CLIENTS."`");
$db->query("DROP TABLE IF EXISTS `".TABLE_FROXLOR_CLIENTS."`");
$db->query("CREATE TABLE IF NOT EXISTS `".TABLE_FROXLOR_CLIENTS."` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`ip` varchar(39) NOT NULL default '',
`enabled` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM;");
lastStepStatus(0);
// add $server_id to userdata.inc.php for upcoming multi-server-support
showUpdateStep("Adding server-id setting for upcoming multi-server support to userdata.inc.php");
$mypath = dirname(dirname(dirname(dirname(dirname(__FILE__))))); // froxlor-rootdir
$userdatafile = makeCorrectFile($mypath.'/lib/userdata.inc.php');
$userdata = @file_get_contents($userdatafile);
$newcontent = '';
if($userdata !== false)
{
$ud = explode("\n", $userdata);
// add server_id lines at the end
$lastidx = count($ud) -1;
while($ud[$lastidx] != "?>")
{
$lastidx--;
}
$ud[$lastidx] = "\n";
$ud[$lastidx++] = "// Define our system id (multiserver support, default is '0')\n";
$ud[$lastidx++] = "\$server_id = 0;\n";
$ud[$lastidx++] = "?>\n";
@copy($userdatafile, $userdatafile.'.bak');
@unlink($userdatafile);
$writesuccess = @fopen($userdatafile, 'w');
if($writesuccess !== false)
{
@fwrite($writesuccess, implode("\n", $ud));
@fclose($writesucsess);
@unlink($userdatafile.'.bak');
lastStepStatus(0);
}
else
{
@copy($userdatafile.'.bak', $userdatafile);
@unlink($userdatafile.'.bak');
lastStepStatus(2, 'Failed to append server-id to userdata.inc.php file. Please put <strong>\$server_id = 0;</strong> to your userdata.inc.php file manually.');
}
}
else
{
lastStepStatus(2, 'Failed to read userdata.inc.php file. Please put <strong>\$server_id = 0;</strong> to your userdata.inc.php file manually.');
}
updateToVersion('0.9.14-svn7');
}
if(isFroxlorVersion('0.9.14-svn7'))
{
showUpdateStep("Updating from 0.9.14-svn7 to 0.9.14-svn8", false);
showUpdateStep("Removing deprecated legacy-cronjob from database");
$db->query("DELETE FROM `".TABLE_PANEL_CRONRUNS."` WHERE `cronfile` ='cron_legacy.php';");
lastStepStatus(0);
updateToVersion('0.9.14-svn8');
}
if(isFroxlorVersion('0.9.14-svn8'))
{
showUpdateStep("Updating from 0.9.14-svn8 to 0.9.14-svn9", false);
showUpdateStep("Updating table 'froxlor_clients'");
$db->query("ALTER TABLE `".TABLE_FROXLOR_CLIENTS."` DROP `ip`;");
$db->query("ALTER TABLE `".TABLE_FROXLOR_CLIENTS."` ADD `desc` text NOT NULL default '' AFTER `id`;");
lastStepStatus(0);
updateToVersion('0.9.14-svn9');
}

View File

@@ -43,3 +43,20 @@ function getPreConfig($current_version)
return '';
}
}
function versionInUpdate($current_version, $version_to_check)
{
if (!isFroxlor()) {
return true;
}
$pos_a = strpos($current_version, '-svn');
$pos_b = strpos($version_to_check, '-svn');
// if we compare svn-versions, we have to add -svn0 to the version
// to compare it correctly
if($pos_a === false && $pos_b !== false)
{
$current_version.= '-svn9999';
}
return version_compare($current_version, $version_to_check, '<');
}

View File

@@ -343,12 +343,4 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question.= makeyesno('update_allow_domain_login', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.14-svn7'))
{
$has_preconfig = true;
$description = 'This update removes the unsupported real-time option. Additionally the deprecated tables for navigation and cronscripts are removed, any modules using these tables need to be updated to the new structure!';
$question = '';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}