interactive update-process;
This commit is contained in:
68
admin_updates.php
Normal file
68
admin_updates.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($page == '') $page = 'overview';
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
||||
|
||||
if(hasUpdates($version))
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
|
||||
echo getTemplate("update/update_start");
|
||||
|
||||
include_once('./install/updatesql.php');
|
||||
|
||||
echo getTemplate("update/update_end");
|
||||
|
||||
updateCounters();
|
||||
inserttask('1');
|
||||
@chmod('./lib/userdata.inc.php', 0440);
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_version = $settings['panel']['version'];
|
||||
$new_version = $version;
|
||||
|
||||
$ui_text = $lng['update']['update_information'];
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
$update_information = $ui_text;
|
||||
|
||||
eval("echo \"" . getTemplate("update/index") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* @TODO version-webcheck check here
|
||||
*/
|
||||
|
||||
$success_message = $lng['update']['noupdatesavail'];
|
||||
$redirect_url = 'admin_index.php';
|
||||
eval("echo \"" . getTemplate("update/noupdatesavail") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
65
index.php
65
index.php
@@ -37,18 +37,48 @@ if($action == 'login')
|
||||
{
|
||||
$loginname = validate($_POST['loginname'], 'loginname');
|
||||
$password = validate($_POST['password'], 'password');
|
||||
$row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
if($row['customer'] == $loginname)
|
||||
|
||||
if(!hasUpdates($version))
|
||||
{
|
||||
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
|
||||
$uid = 'customerid';
|
||||
$adminsession = '0';
|
||||
$row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
if($row['customer'] == $loginname)
|
||||
{
|
||||
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
|
||||
$uid = 'customerid';
|
||||
$adminsession = '0';
|
||||
$is_admin = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_admin = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($is_admin)
|
||||
{
|
||||
if(hasUpdates($version))
|
||||
{
|
||||
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "' AND `change_serversettings` = '1'");
|
||||
/*
|
||||
* not an admin who can see updates
|
||||
*/
|
||||
if(!isset($row['admin']))
|
||||
{
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
}
|
||||
|
||||
if($row['admin'] == $loginname)
|
||||
{
|
||||
$table = "`" . TABLE_PANEL_ADMINS . "`";
|
||||
@@ -121,8 +151,16 @@ if($action == 'login')
|
||||
|
||||
if($userinfo['adminsession'] == '1')
|
||||
{
|
||||
redirectTo('admin_index.php', Array('s' => $s), true);
|
||||
exit;
|
||||
if(hasUpdates($version))
|
||||
{
|
||||
redirectTo('admin_updates.php', Array('s' => $s), true);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('admin_index.php', Array('s' => $s), true);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -164,6 +202,13 @@ if($action == 'login')
|
||||
$message = $lng['error']['errorsendingmail'];
|
||||
break;
|
||||
}
|
||||
|
||||
$update_in_progress = '';
|
||||
if(hasUpdates($version))
|
||||
{
|
||||
$update_in_progress_msg = $lng['update']['updateinprogress_onlyadmincanlogin'];
|
||||
$update_in_progress = getTemplate("updateinprogress");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("login") . "\";");
|
||||
}
|
||||
|
||||
@@ -15,13 +15,188 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r1')
|
||||
if(isFroxlorVersion('0.9-r0'))
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r1 to 0.9-r2");
|
||||
showUpdateStep("Updating from 0.9-r0 to 0.9-r1", false);
|
||||
showUpdateStep("Performing database updates");
|
||||
/*
|
||||
* add missing database-updates if necessary (old: update/update_database.php
|
||||
*/
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '1')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';");
|
||||
}
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '2')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_ipsandports` CHANGE `ssl_cert` `ssl_cert_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_key_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_ca_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `default_vhostconf_domain` TEXT NOT NULL;");
|
||||
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_key_file', `value` = '';");
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_ca_file', `value` = '';");
|
||||
}
|
||||
// eof(lostuff)
|
||||
|
||||
/*
|
||||
* remove billing tables in database
|
||||
*/
|
||||
define('TABLE_BILLING_INVOICES', 'billing_invoices');
|
||||
define('TABLE_BILLING_INVOICES_ADMINS', 'billing_invoices_admins');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES', 'billing_invoice_changes');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES_ADMINS', 'billing_invoice_changes_admins');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES', 'billing_service_categories');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES_ADMINS', 'billing_service_categories_admins');
|
||||
define('TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES', 'billing_service_domains_templates');
|
||||
define('TABLE_BILLING_SERVICE_OTHER', 'billing_service_other');
|
||||
define('TABLE_BILLING_SERVICE_OTHER_TEMPLATES', 'billing_service_other_templates');
|
||||
define('TABLE_BILLING_TAXCLASSES', 'billing_taxclasses');
|
||||
define('TABLE_BILLING_TAXRATES', 'billing_taxrates');
|
||||
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXCLASSES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXRATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE_ADMINS . "`;");
|
||||
|
||||
/*
|
||||
* update panel_domains, panel_customers, panel_admins
|
||||
*/
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "`
|
||||
DROP `firstname`,
|
||||
DROP `title`,
|
||||
DROP `company`,
|
||||
DROP `street`,
|
||||
DROP `zipcode`,
|
||||
DROP `city`,
|
||||
DROP `country`,
|
||||
DROP `phone`,
|
||||
DROP `fax`,
|
||||
DROP `taxid`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `customer_categories_once`,
|
||||
DROP `customer_categories_period`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_hosting_customers`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`,
|
||||
DROP `edit_billingdata`;");
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
DROP `taxid`,
|
||||
DROP `title`,
|
||||
DROP `country`,
|
||||
DROP `additional_service_description`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`;");
|
||||
$db->query("ALTER TABLE `panel_domains`
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`;");
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
WHERE `settinggroup` = 'billing';");
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "`
|
||||
MODIFY `traffic` BIGINT(30),
|
||||
MODIFY `traffic_used` BIGINT(30)");
|
||||
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9-r1');
|
||||
}
|
||||
|
||||
if(isFroxlorVersion('0.9-r1'))
|
||||
{
|
||||
showUpdateStep("Updating from 0.9-r1 to 0.9-r2", false);
|
||||
showUpdateStep("Updating settings table");
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'use_spf', '0');");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'spf_entry', '@ IN TXT \"v=spf1 a mx -all\"');");
|
||||
$db->query("UPDATE `panel_settings` SET `varname` = 'froxlor_graphic' WHERE `varname` = 'syscp_graphic'");
|
||||
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Converting database tables to UTF-8");
|
||||
|
||||
// Convert all data to UTF-8 to have a sane standard across all data
|
||||
$result = $db->query("SHOW TABLES");
|
||||
@@ -69,38 +244,30 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastStepStatus(0);
|
||||
|
||||
$db->query("UPDATE `panel_settings` SET `varname` = 'froxlor_graphic' WHERE `varname` = 'syscp_graphic'");
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'0.9-r2\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r2';
|
||||
updateToVersion('0.9-r2');
|
||||
}
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r2')
|
||||
if(isFroxlorVersion('0.9-r2'))
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r2 to 0.9-r3");
|
||||
showUpdateStep("Updating from 0.9-r2 to 0.9-r3", false);
|
||||
showUpdateStep("Updating tables");
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_AUTORESPONDER . "` ADD `date_from` int(15) NOT NULL default '-1' AFTER `enabled`");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_AUTORESPONDER . "` ADD `date_until` int(15) NOT NULL default '-1' AFTER `date_from`");
|
||||
|
||||
// set new version
|
||||
lastStepStatus(0);
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'0.9-r3\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r3';
|
||||
updateToVersion('0.9-r3');
|
||||
}
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r3')
|
||||
if(isFroxlorVersion('0.9-r3'))
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r3 to 0.9-r4");
|
||||
showUpdateStep("Updating from 0.9-r3 to 0.9-r4", false);
|
||||
showUpdateStep("Creating new table 'cronjobs_run'");
|
||||
|
||||
$db->query("CREATE TABLE IF NOT EXISTS `cronjobs_run` (
|
||||
`id` bigint(20) NOT NULL auto_increment,
|
||||
@@ -110,6 +277,9 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;");
|
||||
|
||||
lastStepStatus(0);
|
||||
showUpdateStep("Inserting new values into table");
|
||||
|
||||
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (1, 'cron_tasks.php', '5 MINUTES');");
|
||||
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (2, 'cron_legacy.php', '5 MINUTES');");
|
||||
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (3, 'cron_apsinstaller.php', '5 MINUTES');");
|
||||
@@ -119,12 +289,8 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (7, 'cron_used_tickets_reset.php', '1 MONTH');");
|
||||
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (8, 'cron_ticketarchive.php', '1 MONTH');");
|
||||
|
||||
// set new version
|
||||
lastStepStatus(0);
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'0.9-r4\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r4';
|
||||
updateToVersion('0.9-r4');
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -18,193 +18,11 @@
|
||||
$updateto = '0.9-r0';
|
||||
$frontend = 'froxlor';
|
||||
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Upgrading SysCP ".$settings['panel']['version']." to Froxlor ". $updateto);
|
||||
showUpdateStep("Upgrading SysCP ".$settings['panel']['version']." to Froxlor ". $updateto, false);
|
||||
updateToVersion($updateto);
|
||||
|
||||
// set new version
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
// add field frontend
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system','frontend','froxlor')");
|
||||
$settings['panel']['frontend'] = 'froxlor';
|
||||
|
||||
/*
|
||||
* this is the main upgrade
|
||||
*/
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r0')
|
||||
{
|
||||
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r0 to 0.9-r1");
|
||||
|
||||
/*
|
||||
* add missing database-updates if necessary (old: update/update_database.php
|
||||
*/
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '1')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';");
|
||||
}
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '2')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_ipsandports` CHANGE `ssl_cert` `ssl_cert_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_key_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_ca_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `default_vhostconf_domain` TEXT NOT NULL;");
|
||||
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_key_file', `value` = '';");
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_ca_file', `value` = '';");
|
||||
}
|
||||
// eof(lostuff)
|
||||
|
||||
/*
|
||||
* remove billing tables in database
|
||||
*/
|
||||
define('TABLE_BILLING_INVOICES', 'billing_invoices');
|
||||
define('TABLE_BILLING_INVOICES_ADMINS', 'billing_invoices_admins');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES', 'billing_invoice_changes');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES_ADMINS', 'billing_invoice_changes_admins');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES', 'billing_service_categories');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES_ADMINS', 'billing_service_categories_admins');
|
||||
define('TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES', 'billing_service_domains_templates');
|
||||
define('TABLE_BILLING_SERVICE_OTHER', 'billing_service_other');
|
||||
define('TABLE_BILLING_SERVICE_OTHER_TEMPLATES', 'billing_service_other_templates');
|
||||
define('TABLE_BILLING_TAXCLASSES', 'billing_taxclasses');
|
||||
define('TABLE_BILLING_TAXRATES', 'billing_taxrates');
|
||||
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXCLASSES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXRATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE_ADMINS . "`;");
|
||||
|
||||
/*
|
||||
* update panel_domains, panel_customers, panel_admins
|
||||
*/
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "`
|
||||
DROP `firstname`,
|
||||
DROP `title`,
|
||||
DROP `company`,
|
||||
DROP `street`,
|
||||
DROP `zipcode`,
|
||||
DROP `city`,
|
||||
DROP `country`,
|
||||
DROP `phone`,
|
||||
DROP `fax`,
|
||||
DROP `taxid`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `customer_categories_once`,
|
||||
DROP `customer_categories_period`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_hosting_customers`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`,
|
||||
DROP `edit_billingdata`;");
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
DROP `taxid`,
|
||||
DROP `title`,
|
||||
DROP `country`,
|
||||
DROP `additional_service_description`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`;");
|
||||
$db->query("ALTER TABLE `panel_domains`
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`;");
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
WHERE `settinggroup` = 'billing';");
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "`
|
||||
MODIFY `traffic` BIGINT(30),
|
||||
MODIFY `traffic_used` BIGINT(30)");
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'0.9-r1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r1';
|
||||
|
||||
}
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system','frontend','".$frontend."')");
|
||||
$settings['panel']['frontend'] = $frontend;
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,42 +17,6 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
|
||||
*/
|
||||
|
||||
require ('../lib/userdata.inc.php');
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
*/
|
||||
|
||||
require ('../lib/tables.inc.php');
|
||||
|
||||
/**
|
||||
* Inlcudes the MySQL-Connection-Class
|
||||
*/
|
||||
|
||||
require ('../lib/classes/database/class.db.php');
|
||||
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
|
||||
unset($sql['password']);
|
||||
unset($db->password);
|
||||
$result = $db->query("SELECT `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$settings[$row['settinggroup']][$row['varname']] = $row['value'];
|
||||
}
|
||||
|
||||
unset($row);
|
||||
unset($result);
|
||||
|
||||
/**
|
||||
* Inlcudes the Functions
|
||||
*/
|
||||
|
||||
require ('../lib/functions.php');
|
||||
|
||||
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings);
|
||||
|
||||
/*
|
||||
@@ -119,25 +83,20 @@ if(!isset($settings['panel']['frontend'])
|
||||
* when we reach this part, all necessary updates
|
||||
* should have been installes automatically by the
|
||||
* update scripts.
|
||||
*
|
||||
* From now on, these update-scripts will not
|
||||
* do their work on their own...they will ask!
|
||||
*/
|
||||
include_once ('./updates/froxlor/upgrade_syscp.inc.php');
|
||||
|
||||
}
|
||||
|
||||
if(isset($settings['panel']['frontend'])
|
||||
&& $settings['panel']['frontend'] == 'froxlor')
|
||||
if(isFroxlor())
|
||||
{
|
||||
if($settings['panel']['version'] == '0.9-r1')
|
||||
if(isFroxlorVersion('0.9-r0'))
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r1");
|
||||
include_once ('./updates/froxlor/0.9/update_0.9.inc.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateCounters();
|
||||
inserttask('1');
|
||||
@chmod('../lib/userdata.inc.php', 0440);
|
||||
header('Location: ../index.php');
|
||||
|
||||
?>
|
||||
|
||||
145
lib/functions/froxlor/function.updateFunctions.php
Normal file
145
lib/functions/froxlor/function.updateFunctions.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Function updateToVersion
|
||||
*
|
||||
* updates the panel.version field
|
||||
* to the given value (no checks here!)
|
||||
*
|
||||
* @param string new-version
|
||||
*
|
||||
* @return bool true on success, else false
|
||||
*/
|
||||
function updateToVersion($new_version = null)
|
||||
{
|
||||
global $db, $settings;
|
||||
|
||||
if($new_version !== null && $new_version != '')
|
||||
{
|
||||
$query = "UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = '" . $new_version . "' WHERE `settinggroup` = 'panel' AND `varname` = 'version'";
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $new_version;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function isFroxlor
|
||||
*
|
||||
* checks if the panel is froxlor
|
||||
*
|
||||
* @return bool true if panel is froxlor, else false
|
||||
*/
|
||||
function isFroxlor()
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if(isset($settings['panel']['frontend'])
|
||||
&& $settings['panel']['frontend'] == 'froxlor')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function isFroxlorVersion
|
||||
*
|
||||
* checks if a given version is the
|
||||
* current one (and panel is froxlor)
|
||||
*
|
||||
* @param string version to check
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
function isFroxlorVersion($to_check = null)
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == $to_check)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function isFroxlorVersion
|
||||
*
|
||||
* checks if a given version is the
|
||||
* current one (and panel is froxlor)
|
||||
*
|
||||
* @param string version to check
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
function hasUpdates($to_check = null)
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if(!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $to_check)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function showUpdateStep
|
||||
*
|
||||
* outputs and logs the current
|
||||
* update progress
|
||||
*
|
||||
* @param string task/status
|
||||
* @param bool needs_status (if false, a linebreak will be added)
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
*/
|
||||
function showUpdateStep($task = null, $needs_status = true)
|
||||
{
|
||||
global $updatelog;
|
||||
|
||||
// output
|
||||
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, $task);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function lastStepStatus
|
||||
*
|
||||
* outputs [OK] (success), [??] (warning) or [!!] (failure)
|
||||
* of the last update-step
|
||||
*
|
||||
* @param int status (0 = success, 1 = warning, -1 = failure)
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
*/
|
||||
function lastStepStatus($status = -1)
|
||||
{
|
||||
global $updatelog;
|
||||
|
||||
// output
|
||||
|
||||
if($status == -1)
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
}
|
||||
}
|
||||
@@ -151,13 +151,6 @@ if(get_magic_quotes_gpc())
|
||||
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
|
||||
$settings = loadSettings(&$settings_data, &$db);
|
||||
|
||||
if(!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $version)
|
||||
{
|
||||
redirectTo('install/updatesql.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* SESSION MANAGEMENT
|
||||
*/
|
||||
|
||||
@@ -1260,5 +1260,10 @@ $lng['autoresponder']['date_until'] = 'End date';
|
||||
$lng['autoresponder']['startenddate'] = 'Start/end date';
|
||||
$lng['panel']['not_activated'] = 'not activated';
|
||||
$lng['panel']['off'] = 'off';
|
||||
$lng['update']['updateinprogress_onlyadmincanlogin'] = 'A newer version of Froxlor has been installed but not net set up.<br />Only the administrator can login in and finish the update.';
|
||||
$lng['update']['update'] = 'Froxlor Update';
|
||||
$lng['update']['proceed'] = 'Proceed';
|
||||
$lng['update']['update_information'] = 'The Froxlor files have been updated to version <strong>%newversion</strong>. The installed version is <strong>%curversion</strong>.<br /><br />Customers will not be able to log in until the update has been finished.<br /><strong>Proceed?</strong>';
|
||||
$lng['update']['noupdatesavail'] = '<strong>You already have the latest Froxlor version.</strong>';
|
||||
|
||||
?>
|
||||
|
||||
@@ -1240,5 +1240,10 @@ $lng['autoresponder']['date_until'] = 'End-Datum';
|
||||
$lng['autoresponder']['startenddate'] = 'Start/End-Datum';
|
||||
$lng['panel']['not_activated'] = 'Nicht aktiviert';
|
||||
$lng['panel']['off'] = 'aus';
|
||||
$lng['update']['updateinprogress_onlyadmincanlogin'] = 'Eine neuere Version von Froxlor wurde installiert, aber noch nicht eingerichtet.<br />Nur der Administrator kann sich anmelden und die Aktualisierung abschließen.';
|
||||
$lng['update']['update'] = 'Froxlor Aktualisierung';
|
||||
$lng['update']['proceed'] = 'Ausführen';
|
||||
$lng['update']['update_information'] = 'Die Froxlor Dateien wurden aktualisiert. Neue Version ist <strong>%newversion</strong>. Die bisher installierte Version ist <strong>%curversion</strong><br /><br />Ein Kunden-Login ist vor Abschluss des Aktualisierungsvorganges nicht m&oouml;glich.<br /><strong>Aktualisierung ausführen?</strong>';
|
||||
$lng['update']['noupdatesavail'] = '<strong>Ihre Froxlor-Version ist aktuell.</strong>';
|
||||
|
||||
?>
|
||||
|
||||
21
templates/admin/update/index.tpl
Normal file
21
templates/admin/update/index.tpl
Normal file
@@ -0,0 +1,21 @@
|
||||
$header
|
||||
<form action="$filename" method="post">
|
||||
<input type="hidden" name="s" value="$s"/>
|
||||
<input type="hidden" name="page" value="$page"/>
|
||||
<input type="hidden" name="send" value="send" />
|
||||
<table cellpadding="5" cellspacing="0" border="0" align="center" class="maintable">
|
||||
<tr>
|
||||
<td class="maintitle"><b><img src="images/title.gif" alt="" /> {$lng['update']['update']}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="field_name_center">{$update_information}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="field_name_center"><input type="hidden" name="send" value="send" /><input type="submit" class="bottom" value="{$lng['update']['proceed']}" /></td>
|
||||
</tr>
|
||||
</if>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
<br />
|
||||
$footer
|
||||
13
templates/admin/update/noupdatesavail.tpl
Normal file
13
templates/admin/update/noupdatesavail.tpl
Normal file
@@ -0,0 +1,13 @@
|
||||
$header
|
||||
<table cellpadding="5" cellspacing="0" border="0" align="center" class="maintable_60">
|
||||
<tr>
|
||||
<td class="maintitle" colspan="2"><b> <img src="images/title.gif" alt="" /> {$lng['update']['update']}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="field_name_center_noborder"><img src="images/info.png" alt="" /></td>
|
||||
<td class="field_name">$success_message<if $redirect_url != ''><br /><a href="{$redirect_url}">{$lng['success']['clickheretocontinue']}</if></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
$footer
|
||||
7
templates/admin/update/update_end.tpl
Normal file
7
templates/admin/update/update_end.tpl
Normal file
@@ -0,0 +1,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
$footer
|
||||
8
templates/admin/update/update_start.tpl
Normal file
8
templates/admin/update/update_start.tpl
Normal file
@@ -0,0 +1,8 @@
|
||||
$header
|
||||
<table cellpadding="5" cellspacing="0" border="0" align="center" class="maintable">
|
||||
<tr>
|
||||
<td class="maintitle"><b><img src="images/title.gif" alt="" /> {$lng['update']['update']}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="field_name_center">
|
||||
<div class="update_progess">
|
||||
@@ -39,6 +39,11 @@ $header
|
||||
<td class="field_name_center" colspan="3"><a href="$filename?action=forgotpwd">{$lng['login']['forgotpwd']}</a></td>
|
||||
</tr>
|
||||
</if>
|
||||
<if $update_in_progress !== ''>
|
||||
<tr>
|
||||
<td class="field_name_center" colspan="3">{$update_in_progress}</td>
|
||||
</tr>
|
||||
</if>
|
||||
</table>
|
||||
</form>
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user