removed ticketsystem; lots of work on cron stuff

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-19 13:09:14 +01:00
parent 903b775f79
commit 3ff20e327f
86 changed files with 3823 additions and 7421 deletions

View File

@@ -118,9 +118,6 @@ CREATE TABLE `panel_admins` (
`email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0',
`ftps_used` int(15) NOT NULL default '0',
`tickets` int(15) NOT NULL default '-1',
`tickets_used` int(15) NOT NULL default '0',
`tickets_see_all` tinyint(1) NOT NULL default '0',
`subdomains` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0',
@@ -173,8 +170,6 @@ CREATE TABLE `panel_customers` (
`email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0',
`ftps_used` int(15) NOT NULL default '0',
`tickets` int(15) NOT NULL default '0',
`tickets_used` int(15) NOT NULL default '0',
`subdomains` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0',
@@ -367,17 +362,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('customer', 'ftpatdomain', '0'),
('customer', 'show_news_feed', '0'),
('customer', 'news_feed_url', ''),
('ticket', 'noreply_email', 'NO-REPLY@SERVERNAME'),
('ticket', 'worktime_all', '1'),
('ticket', 'worktime_begin', '00:00'),
('ticket', 'worktime_end', '23:59'),
('ticket', 'worktime_sat', '0'),
('ticket', 'worktime_sun', '0'),
('ticket', 'archiving_days', '5'),
('ticket', 'enabled', '1'),
('ticket', 'concurrently_open', '5'),
('ticket', 'noreply_name', 'Hosting Support'),
('ticket', 'reset_cycle', '2'),
('logger', 'enabled', '1'),
('logger', 'log_cron', '0'),
('logger', 'logfile', ''),
@@ -404,7 +388,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('defaultwebsrverrhandler', 'err403', ''),
('defaultwebsrverrhandler', 'err404', ''),
('defaultwebsrverrhandler', 'err500', ''),
('ticket', 'default_priority', '2'),
('customredirect', 'enabled', '1'),
('customredirect', 'default', '1'),
('perl', 'suexecworkaround', '0'),
@@ -635,7 +618,7 @@ opcache.interned_strings_buffer'),
('system', 'leapiversion', '1'),
('system', 'backupenabled', '0'),
('system', 'dnsenabled', '0'),
('system', 'dns_server', 'bind'),
('system', 'dns_server', 'Bind'),
('system', 'apacheglobaldiropt', ''),
('system', 'allow_customer_shell', '0'),
('system', 'available_shells', ''),
@@ -697,7 +680,7 @@ opcache.interned_strings_buffer'),
('panel', 'customer_hide_options', ''),
('panel', 'is_configured', '0'),
('panel', 'version', '0.10.0'),
('panel', 'db_version', '201812180');
('panel', 'db_version', '201812190');
DROP TABLE IF EXISTS `panel_tasks`;
@@ -816,41 +799,6 @@ INSERT INTO `panel_languages` (`id`, `language`, `iso`, `file`) VALUES
(7, 'Svenska', 'sv', 'lng/swedish.lng.php');
DROP TABLE IF EXISTS `panel_tickets`;
CREATE TABLE `panel_tickets` (
`id` int(11) unsigned NOT NULL auto_increment,
`customerid` int(11) NOT NULL,
`adminid` int(11) NOT NULL,
`category` smallint(5) unsigned NOT NULL default '1',
`priority` enum('1','2','3') NOT NULL default '3',
`subject` varchar(70) NOT NULL,
`message` text NOT NULL,
`dt` int(15) NOT NULL,
`lastchange` int(15) NOT NULL,
`ip` varchar(39) NOT NULL default '',
`status` enum('0','1','2','3') NOT NULL default '1',
`lastreplier` enum('0','1') NOT NULL default '0',
`answerto` int(11) unsigned NOT NULL,
`by` enum('0','1') NOT NULL default '0',
`archived` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_ticket_categories`;
CREATE TABLE `panel_ticket_categories` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`name` varchar(60) NOT NULL,
`adminid` int(11) NOT NULL,
`logicalorder` int(3) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_syslog`;
CREATE TABLE IF NOT EXISTS `panel_syslog` (
`logid` bigint(20) NOT NULL auto_increment,
@@ -930,6 +878,7 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
`id` bigint(20) NOT NULL auto_increment,
`module` varchar(250) NOT NULL,
`cronfile` varchar(250) NOT NULL,
`cronclass` varchar(500) NOT NULL,
`lastrun` int(15) NOT NULL DEFAULT '0',
`interval` varchar(100) NOT NULL DEFAULT '5 MINUTE',
`isactive` tinyint(1) DEFAULT '1',
@@ -938,15 +887,13 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'tasks', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/ticket', 'used_tickets_reset', '1 DAY', '1', 'cron_ticketsreset'),
(4, 'froxlor/ticket', 'ticketarchive', '1 MONTH', '1', 'cron_ticketarchive'),
(5, 'froxlor/reports', 'usage_report', '1 DAY', '1', 'cron_usage_report'),
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize'),
(7, 'froxlor/letsencrypt', 'letsencrypt', '5 MINUTE', '0', 'cron_letsencrypt'),
(8, 'froxlor/backup', 'backup', '1 DAY', '1', 'cron_backup');
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `cronclass`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'tasks', '\\Froxlor\\Cron\\TasksCron', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '\\Froxlor\\Cron\\Traffic\\TrafficCron', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/reports', 'usage_report', '\\Froxlor\\Cron\\Traffic\\ReportsCron', '1 DAY', '1', 'cron_usage_report'),
(4, 'froxlor/core', 'mailboxsize', '\\Froxlor\\Cron\\System\\MailboxsizeCron', '6 HOUR', '1', 'cron_mailboxsize'),
(5, 'froxlor/letsencrypt', 'letsencrypt', '\\Froxlor\\Cron\\LetsEncrypt\\LetsEncrypt', '5 MINUTE', '0', 'cron_letsencrypt'),
(6, 'froxlor/backup', 'backup', '\\Froxlor\\Cron\\System\\BackupCron', '1 DAY', '1', 'cron_backup');

View File

@@ -1,5 +1,8 @@
<?php
use \Froxlor\Database;
use \Froxlor\Settings;
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
@@ -21,9 +24,9 @@ if (! defined('_CRON_UPDATE')) {
}
}
if (isFroxlorVersion('0.9.40.1')) {
if (\Froxlor\Froxlor::isFroxlorVersion('0.9.40.1')) {
showUpdateStep("Updating from 0.9.40.1 to 0.10.0", false);
showUpdateStep("Adding new api keys table");
Database::query("DROP TABLE IF EXISTS `api_keys`;");
$sql = "CREATE TABLE `api_keys` (
@@ -40,15 +43,15 @@ if (isFroxlorVersion('0.9.40.1')) {
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;";
Database::query($sql);
lastStepStatus(0);
showUpdateStep("Adding new api settings");
Settings::AddNew('api.enabled', 0);
lastStepStatus(0);
showUpdateStep("Adding new default-ssl-ip setting");
Settings::AddNew('system.defaultsslip', '');
lastStepStatus(0);
showUpdateStep("Altering admin ip's field to allow multiple ip addresses");
// get all admins for updating the new field
$sel_stmt = Database::prepare("SELECT adminid, ip FROM `panel_admins`");
@@ -65,20 +68,20 @@ if (isFroxlorVersion('0.9.40.1')) {
}
}
lastStepStatus(0);
updateToVersion('0.10.0');
\Froxlor\Froxlor::updateToVersion('0.10.0');
}
if (isDatabaseVersion('201809280')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201809280')) {
showUpdateStep("Adding dhparams-file setting");
Settings::AddNew("system.dhparams_file", '');
Settings::AddNew("system.dhparams_file", '');
lastStepStatus(0);
updateToDbVersion('201811180');
\Froxlor\Froxlor::updateToDbVersion('201811180');
}
if (isDatabaseVersion('201811180')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201811180')) {
showUpdateStep("Adding new settings for 2FA");
Settings::AddNew('2fa.enabled', '1', true);
@@ -94,33 +97,74 @@ if (isDatabaseVersion('201811180')) {
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `data_2fa` varchar(500) NOT NULL default '' AFTER `type_2fa`;");
lastStepStatus(0);
updateToDbVersion('201811300');
\Froxlor\Froxlor::updateToDbVersion('201811300');
}
if (isDatabaseVersion('201811300')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201811300')) {
showUpdateStep("Adding new logview-flag to customers");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `logviewenabled` tinyint(1) NOT NULL default '0';");
lastStepStatus(0);
updateToDbVersion('201812010');
\Froxlor\Froxlor::updateToDbVersion('201812010');
}
if (isDatabaseVersion('201812010')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201812010')) {
showUpdateStep("Adding new is_configured-flag");
// updated systems are already configured (most likely :P)
Settings::AddNew('panel.is_configured', '1', true);
lastStepStatus(0);
updateToDbVersion('201812100');
\Froxlor\Froxlor::updateToDbVersion('201812100');
}
if (isDatabaseVersion('201812100')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201812100')) {
showUpdateStep("Adding fields writeaccesslog and writeerrorlog for domains");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `writeaccesslog` tinyint(1) NOT NULL default '1';");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `writeerrorlog` tinyint(1) NOT NULL default '1';");
lastStepStatus(0);
updateToDbVersion('201812180');
\Froxlor\Froxlor::updateToDbVersion('201812180');
}
if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
showUpdateStep("Updating cronjob table");
Database::query("ALTER TABLE `" . TABLE_PANEL_CRONRUNS . "` ADD `cronclass` varchar(500) NOT NULL AFTER `cronfile`");
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `cronclass` = :cc WHERE `cronfile` = :cf");
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\TasksCron', 'cf' => 'tasks'));
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\TrafficCron', 'cf' => 'traffic'));
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\ReportsCron', 'cf' => 'usage_report'));
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\System\\MailboxsizeCron', 'cf' => 'mailboxsize'));
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\LetsEncrypt\\LetsEncrypt', 'cf' => 'letsencrypt'));
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\System\\BackupCron', 'cf' => 'backup'));
Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/ticket'");
lastStepStatus(0);
showUpdateStep("Removing ticketsystem");
Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `tickets`");
Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `tickets_used`");
Database::query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "` DROP `tickets_see_all`");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `tickets`");
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `tickets_used`");
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'ticket'");
define('TABLE_PANEL_TICKETS', 'panel_tickets');
define('TABLE_PANEL_TICKET_CATS', 'panel_ticket_categories');
Database::query("DROP TABLE IF EXISTS `" . TABLE_PANEL_TICKETS . "`;");
Database::query("DROP TABLE IF EXISTS `" . TABLE_PANEL_TICKET_CATS . "`;");
lastStepStatus(0);
showUpdateStep("Updating nameserver settings");
$dns_target = 'Bind';
if (Settings::Get('system.dns_server') != 'bind') {
$dns_target = 'PowerDNS';
}
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :v WHERE `settinggroup` = 'system' AND `varname` = 'dns_server'");
Database::pexecute($upd_stmt, array('v' => $dns_target));
lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('201812190');
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +0,0 @@
<?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 Install
*
*/
if (!defined('AREA')
|| (defined('AREA') && AREA != 'admin')
|| !isset($userinfo['loginname'])
|| (isset($userinfo['loginname']) && $userinfo['loginname'] == '')
) {
header('Location: ../../../index.php');
exit;
}
$updateto = '0.9-r0';
$frontend = 'froxlor';
showUpdateStep("Upgrading SysCP ".Settings::Get('panel.version')." to Froxlor ". $updateto, false);
updateToVersion($updateto);
// add field frontend
Database::query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET
`settinggroup` = 'panel',
`varname` = 'frontend',
`value` = 'froxlor'"
);
Settings::Set('panel.frontend', $frontend);

View File

@@ -31,14 +31,14 @@ function getPreConfig($current_version, $current_db_version)
$has_preconfig = false;
$return = '<div class="preconfig"><h3 class="red">PLEASE NOTE - Important update notifications</h3>';
include_once makeCorrectFile(dirname(__FILE__).'/preconfig/0.9/preconfig_0.9.inc.php');
include_once \Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/preconfig/0.9/preconfig_0.9.inc.php');
parseAndOutputPreconfig($has_preconfig, $return, $current_version, $current_db_version);
$return .= '<br /><br />'.makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '<br /><br />' . makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '</div>';
$return .= '<input type="hidden" name="update_preconfig" value="1" />';
if($has_preconfig) {
if ($has_preconfig) {
return $return;
} else {
return '';
@@ -47,9 +47,9 @@ function getPreConfig($current_version, $current_db_version)
function versionInUpdate($current_version, $version_to_check)
{
if (!isFroxlor()) {
if (! isFroxlor()) {
return true;
}
return (version_compare2($current_version, $version_to_check) == -1 ? true : false);
return (version_compare2($current_version, $version_to_check) == - 1 ? true : false);
}

View File

@@ -14,6 +14,9 @@
* @package Language
*
*/
use Froxlor\Database;
use Froxlor\Settings;
use PHPMailer\PHPMailer;
/**
* checks if the new-version has some updating to do
@@ -24,7 +27,7 @@
* pointer to output string
* @param string $current_version
* current froxlor version
*
*
* @return null
*/
function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $current_db_version)
@@ -130,7 +133,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
$description = 'Resetting the open_basedir to customer - root';
$question = '<strong>Due to a security - issue regarding open_basedir, Froxlor will set the open_basedir for the following domains to the customers root instead of the chosen documentroot:</strong><br />&nbsp;';
$question .= '<ul>';
$idna_convert = new idna_convert_wrapper();
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
foreach ($wrongOpenBasedirDomain as $domain) {
$question .= '<li>' . $idna_convert->decode($domain) . '</li>';
}
@@ -381,7 +384,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
$question .= '<select name="update_default_theme">';
$themes = getThemes();
foreach ($themes as $cur_theme) // $theme is already in use
{
{
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
}
$question .= '</select>';

View File

@@ -16,55 +16,39 @@
* @package Install
*
*/
use Froxlor\FroxlorLogger;
if (!defined('_CRON_UPDATE')) {
if (!defined('AREA')
|| (defined('AREA') && AREA != 'admin')
|| !isset($userinfo['loginname'])
|| (isset($userinfo['loginname']) && $userinfo['loginname'] == '')
) {
if (! defined('_CRON_UPDATE')) {
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
header('Location: ../index.php');
exit;
exit();
}
}
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'));
$updatelogfile = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__).'/update.log'));
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'));
$filelog->setLogFile($updatelogfile);
$filelog = FroxlorLogger::getInstanceOf(array(
'loginname' => 'updater'
));
// if first writing does not work we'll stop, tell the user to fix it
// and then let him try again.
try {
$filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------');
} catch(Exception $e) {
} catch (Exception $e) {
standard_error('exception', $e->getMessage());
}
/*
* since froxlor, we have to check if there's still someone
* out there using syscp and needs to upgrade
*/
if(!isFroxlor()) {
/**
* Upgrading SysCP to Froxlor-0.9
*/
include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/upgrade_syscp.inc.php'));
}
if (isFroxlor()) {
include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/0.9/update_0.9.inc.php'));
include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/0.10/update_0.10.inc.php'));
if (\Froxlor\Froxlor::isFroxlor()) {
include_once (\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.9/update_0.9.inc.php'));
include_once (\Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.10/update_0.10.inc.php'));
// Check Froxlor - database integrity (only happens after all updates are done, so we know the db-layout is okay)
showUpdateStep("Checking database integrity");
$integrity = new IntegrityCheck();
if (!$integrity->checkAll()) {
if (! $integrity->checkAll()) {
lastStepStatus(1, 'Monkeys ate the integrity');
showUpdateStep("Trying to remove monkeys, feeding bananas");
if(!$integrity->fixAll()) {
if (! $integrity->fixAll()) {
lastStepStatus(2, 'Some monkeys just would not move, you should contact team@froxlor.org');
} else {
lastStepStatus(0, 'Integrity restored');