more work on the new cronhandling

This commit is contained in:
Michael Kaufmann (d00p)
2010-01-25 15:32:36 +00:00
parent 6e5746a598
commit f82b611b0a
22 changed files with 151 additions and 36 deletions

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -11,7 +11,7 @@
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -1,17 +1,19 @@
<?php <?php
/** /**
* This file is part of the SysCP project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors). * Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the * file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt * @author Froxlor team <team@froxlor.org> (2010-)
* @package Panel * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

View File

@@ -13,7 +13,7 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Settings
* @version $Id$ * @version $Id$
*/ */

54
admin_cronjobs.php Normal file
View File

@@ -0,0 +1,54 @@
<?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_once("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']);
}
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']);
}
if($page == 'cronjobs'
&& $userinfo['customers'] != '0')
{
if($action == '')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_cronjobs");
}
elseif($action == 'new')
{
}
elseif($action == 'edit'
&& $id != 0)
{
}
elseif($action == 'delete'
&& $id != 0)
{
}
}
?>

View File

@@ -930,7 +930,7 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
`id` bigint(20) NOT NULL auto_increment, `id` bigint(20) NOT NULL auto_increment,
`cronfile` varchar(250) NOT NULL, `cronfile` varchar(250) NOT NULL,
`lastrun` int(15) NOT NULL DEFAULT '0', `lastrun` int(15) NOT NULL DEFAULT '0',
`interval` INTERVAL DEFAULT '5M', `interval` varchar(100) DEFAULT '5 MINUTES',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM;
@@ -938,11 +938,11 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
# Dumping data for table `panel_phpconfigs` # Dumping data for table `panel_phpconfigs`
# #
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (1, 'cron_tasks.php', '5M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (1, 'cron_tasks.php', '5 MINUTES');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (2, 'cron_legacy.php', '5M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (2, 'cron_legacy.php', '5 MINUTES');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (3, 'cron_apsinstaller.php', '5M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (3, 'cron_apsinstaller.php', '5 MINUTES');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (4, 'cron_autoresponder.php', '5M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (4, 'cron_autoresponder.php', '5 MINUTES');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (5, 'cron_apsupdater.php', '1H'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (5, 'cron_apsupdater.php', '1 HOUR');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (6, 'cron_traffic.php', '1D'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (6, 'cron_traffic.php', '1 DAY');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (7, 'cron_used_tickets_reset.php', '1M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (7, 'cron_used_tickets_reset.php', '1 MONTH');
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (8, 'cron_ticketarchive.php', '1M'); INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (8, 'cron_ticketarchive.php', '1 MONTH');

View File

@@ -106,18 +106,18 @@ if($settings['panel']['frontend'] == 'froxlor'
`id` bigint(20) NOT NULL auto_increment, `id` bigint(20) NOT NULL auto_increment,
`cronfile` varchar(250) NOT NULL, `cronfile` varchar(250) NOT NULL,
`lastrun` int(15) NOT NULL DEFAULT '0', `lastrun` int(15) NOT NULL DEFAULT '0',
`interval` INTERVAL DEFAULT '5M', `interval` varchar(100) DEFAULT '5 MINUTES',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM;"); ) ENGINE=MyISAM;");
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (1, 'cron_tasks.php', '5M');"); $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', '5M');"); $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', '5M');"); $db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (3, 'cron_apsinstaller.php', '5 MINUTES');");
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (4, 'cron_autoresponder.php', '5M');"); $db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (4, 'cron_autoresponder.php', '5 MINUTES');");
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (5, 'cron_apsupdater.php', '1H');"); $db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (5, 'cron_apsupdater.php', '1 HOUR');");
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (6, 'cron_traffic.php', '1D');"); $db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (6, 'cron_traffic.php', '1 DAY');");
$db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (7, 'cron_used_tickets_reset.php', '1M');"); $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', '1M');"); $db->query("INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (8, 'cron_ticketarchive.php', '1 MONTH');");
// set new version // set new version

View File

@@ -0,0 +1,34 @@
<?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 Settings
* @version $Id: $
*/
function getIntervalOptions()
{
global $db, $lng;
$query = "SELECT DISTINCT `interval` FROM `" . TABLE_PANEL_CRONRUNS . "` ORDER BY `interval` ASC;";
$result = $db->query($query);
$cron_intervals = array();
$cron_intervals['0'] = $lng['panel']['off'];
while($row = $db->fetch_array($result))
{
$cron_intervals[$row['interval']] = $row['interval'];
}
return $cron_intervals;
}

View File

@@ -24,5 +24,26 @@
*/ */
function getNextCronjobs() function getNextCronjobs()
{ {
// SELECT `interval`, `lastrun` FROM `".PANEL_TABLE_CRONRUNS."` $sql = "SELECT `cronfile` FROM `".TABLE_PANEL_CRONRUNS."` WHERE `interval` <> '0' AND (";
/*
* 5M - 5 minute cronjob (reqular)
*/
$intervals = getIntervalOptions();
$x = 0;
foreach($intervals as $name => $ival)
{
if($name == '0') continue;
if($x == 0) {
$sql.= 'DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.') <= CURDATE()';
} else {
$sql.= ' OR DATE_ADD(UNIX_TIMESTAMP(`lastrun`), INTERVAL '.$ival.') <= CURDATE()';
}
$x++;
}
$sql.= ');';
$result = $db->query($query);
} }

View File

@@ -22,5 +22,6 @@ function includeCronjobs($debugHandler)
if($cronjobs !== false) if($cronjobs !== false)
{ {
// [...] // [...]
$cron_path = dirname(__FILE__).'/../../../scripts/jobs/';
} }
} }

View File

@@ -48,6 +48,7 @@ define('TABLE_APS_INSTANCES', 'aps_instances');
define('TABLE_APS_SETTINGS', 'aps_settings'); define('TABLE_APS_SETTINGS', 'aps_settings');
define('TABLE_APS_TASKS', 'aps_tasks'); define('TABLE_APS_TASKS', 'aps_tasks');
define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings'); define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings');
define('TABLE_PANEL_CRONRUNS', 'cronjobs_run');
// APS constants // APS constants

View File

@@ -1259,5 +1259,6 @@ $lng['autoresponder']['date_from'] = 'Start date';
$lng['autoresponder']['date_until'] = 'End date'; $lng['autoresponder']['date_until'] = 'End date';
$lng['autoresponder']['startenddate'] = 'Start/end date'; $lng['autoresponder']['startenddate'] = 'Start/end date';
$lng['panel']['not_activated'] = 'not activated'; $lng['panel']['not_activated'] = 'not activated';
$lng['panel']['off'] = 'off';
?> ?>

View File

@@ -1239,5 +1239,6 @@ $lng['autoresponder']['date_from'] = 'Start-Datum';
$lng['autoresponder']['date_until'] = 'End-Datum'; $lng['autoresponder']['date_until'] = 'End-Datum';
$lng['autoresponder']['startenddate'] = 'Start/End-Datum'; $lng['autoresponder']['startenddate'] = 'Start/End-Datum';
$lng['panel']['not_activated'] = 'Nicht aktiviert'; $lng['panel']['not_activated'] = 'Nicht aktiviert';
$lng['panel']['off'] = 'aus';
?> ?>