From 433c8669f4e8c32427cbfbd8ab6fa602617238af Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sat, 1 May 2010 14:08:52 +0000 Subject: [PATCH] - minor fixes in update-process for ftp-quota stuff, refs #13 --- .../{220.ftpserver.php => 155.ftpserver.php} | 0 install/updates/froxlor/0.9/update_0.9.inc.php | 8 +++++--- install/updates/preconfig/0.9/preconfig_0.9.inc.php | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) rename actions/admin/settings/{220.ftpserver.php => 155.ftpserver.php} (100%) diff --git a/actions/admin/settings/220.ftpserver.php b/actions/admin/settings/155.ftpserver.php similarity index 100% rename from actions/admin/settings/220.ftpserver.php rename to actions/admin/settings/155.ftpserver.php diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index b30ac321..6e644c99 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -619,8 +619,10 @@ if(isFroxlorVersion('0.9.6-svn5')) showUpdateStep("Adding new FTP-quota settings"); + $update_defsys_ftpserver = isset($_POST['update_defsys_ftpserver']) ? intval($_POST['update_defsys_ftpserver']) : 'proftpd'; + // add ftp server setting - $db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ftpserver', `value` = 'proftpd';"); + $db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ftpserver', `value` = '".$db->escape($update_defsys_ftpserver)."';"); // add proftpd quota $db->query("CREATE TABLE`ftp_quotalimits` (`name` varchar(30) default NULL, `quota_type` enum('user','group','class','all') NOT NULL default 'user', `per_session` enum('false','true') NOT NULL default 'false', `limit_type` enum('soft','hard') NOT NULL default 'hard', `bytes_in_avail` float NOT NULL, `bytes_out_avail` float NOT NULL, `bytes_xfer_avail` float NOT NULL, `files_in_avail` int(10) unsigned NOT NULL, `files_out_avail` int(10) unsigned NOT NULL, `files_xfer_avail` int(10) unsigned NOT NULL) ENGINE=MyISAM;"); @@ -634,9 +636,9 @@ if(isFroxlorVersion('0.9.6-svn5')) while($row_ftp_users = $db->fetch_array($result_ftp_users)) { - $result_ftp_quota = $db->query("SELECT diskspace_used FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE loginname = SUBSTRING_INDEX('" . $row_ftp_users[username] . "', '" . $settings['customer']['ftpprefix'] . "', 1);"); + $result_ftp_quota = $db->query("SELECT diskspace_used FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE loginname = SUBSTRING_INDEX('" . $row_ftp_users['username'] . "', '" . $settings['customer']['ftpprefix'] . "', 1);"); $row_ftp_quota = mysql_fetch_row($result_ftp_quota); - $db->query("INSERT INTO `ftp_quotatallies` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $row_ftp_users[username] . "', 'user', '" . $row_ftp_quota[0] . "'*1024, '0', '0', '0', '0', '0');"); + $db->query("INSERT INTO `ftp_quotatallies` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $row_ftp_users['username'] . "', 'user', '" . $row_ftp_quota[0] . "'*1024, '0', '0', '0', '0', '0');"); } lastStepStatus(0); diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index 20ce714d..5bfb6d5a 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -95,4 +95,16 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) $question .= $configs.''; eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); } + + if(versionInUpdate($current_version, '0.9.6-svn6')) + { + $has_preconfig = true; + $description = 'For the new FTP-quota feature, you can now chose the currently used ftpd-software.'; + $question = 'Chose ftpd-software: '; + $question .= ''; + eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); + } }