mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 10:27:29 +00:00
prepare for more cronjob-mess :)
This commit is contained in:
parent
28feb0d1b2
commit
6e5746a598
@ -919,3 +919,30 @@ CREATE TABLE IF NOT EXISTS `aps_temp_settings` (
|
||||
`Value` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `cronjobs_run`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cronjobs_run` (
|
||||
`id` bigint(20) NOT NULL auto_increment,
|
||||
`cronfile` varchar(250) NOT NULL,
|
||||
`lastrun` int(15) NOT NULL DEFAULT '0',
|
||||
`interval` INTERVAL DEFAULT '5M',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
#
|
||||
# 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 (2, 'cron_legacy.php', '5M');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (3, 'cron_apsinstaller.php', '5M');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (4, 'cron_autoresponder.php', '5M');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (5, 'cron_apsupdater.php', '1H');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (6, 'cron_traffic.php', '1D');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (7, 'cron_used_tickets_reset.php', '1M');
|
||||
INSERT INTO `cronjobs_run` (`id`, `cronfile`, `interval`) VALUES (8, 'cron_ticketarchive.php', '1M');
|
||||
|
@ -84,18 +84,47 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r2')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r2 to 0.9-r3");
|
||||
|
||||
|
||||
$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
|
||||
|
||||
$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';
|
||||
$settings['panel']['version'] = '0.9-r3';
|
||||
}
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r3')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r3 to 0.9-r4");
|
||||
|
||||
$db->query("CREATE TABLE IF NOT EXISTS `cronjobs_run` (
|
||||
`id` bigint(20) NOT NULL auto_increment,
|
||||
`cronfile` varchar(250) NOT NULL,
|
||||
`lastrun` int(15) NOT NULL DEFAULT '0',
|
||||
`interval` INTERVAL DEFAULT '5M',
|
||||
PRIMARY KEY (`id`)
|
||||
) 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 (2, 'cron_legacy.php', '5M');");
|
||||
$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 (4, 'cron_autoresponder.php', '5M');");
|
||||
$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 (6, 'cron_traffic.php', '1D');");
|
||||
$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 (8, 'cron_ticketarchive.php', '1M');");
|
||||
|
||||
// set new version
|
||||
|
||||
$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';
|
||||
}
|
||||
?>
|
||||
|
||||
|
28
lib/functions/filedir/function.getNextCronjobs.php
Normal file
28
lib/functions/filedir/function.getNextCronjobs.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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 getNextCronjobs
|
||||
*
|
||||
* checks which cronjobs have to be executed
|
||||
*
|
||||
* @return array array of cron-files which are to be executed
|
||||
*/
|
||||
function getNextCronjobs()
|
||||
{
|
||||
// SELECT `interval`, `lastrun` FROM `".PANEL_TABLE_CRONRUNS."`
|
||||
}
|
@ -15,30 +15,12 @@
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
function includeCronjobs($path, $debugHandler)
|
||||
function includeCronjobs($debugHandler)
|
||||
{
|
||||
$cronbasedir = makeCorrectDir($path);
|
||||
$crondir = new DirectoryIterator($cronbasedir);
|
||||
|
||||
foreach($crondir as $file)
|
||||
$cronjobs = getNextCronjobs();
|
||||
|
||||
if($cronjobs !== false)
|
||||
{
|
||||
if($file->isDot()) continue;
|
||||
|
||||
if($file->isFile())
|
||||
{
|
||||
if(fileowner(__FILE__) == $file->getOwner()
|
||||
&& filegroup(__FILE__) == $file->getGroup()
|
||||
&& $file->isReadable())
|
||||
{
|
||||
fwrite($debugHandler, 'Including ...' . $file->getPathname() . "\n");
|
||||
include_once($file->getPathname());
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($debugHandler, 'WARNING! uid and/or gid of "' . __FILE__ . '" and "' . $file->getPathname() . '" don\'t match! Execution aborted!' . "\n");
|
||||
fclose($debugHandler);
|
||||
die('WARNING! uid and/or gid of "' . __FILE__ . '" and "' . $file->getPathname() . '" don\'t match! Execution aborted!');
|
||||
}
|
||||
}
|
||||
// [...]
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
|
||||
$version = '0.9-r3';
|
||||
$version = '0.9-r4';
|
||||
$dbversion = '2';
|
||||
|
||||
?>
|
||||
|
@ -17,41 +17,9 @@
|
||||
|
||||
include_once(dirname(__FILE__) . '/../lib/cron_init.php');
|
||||
|
||||
/*
|
||||
* include jobs that run always (5 minutes if cron is setup that way)
|
||||
*/
|
||||
includeCronjobs($pathtophpfiles . '/scripts/jobs/always/', $debugHandler);
|
||||
|
||||
/*
|
||||
* include hourly jobs
|
||||
*/
|
||||
$today = time();
|
||||
if(date('i', $today) == '00')
|
||||
{
|
||||
includeCronjobs($pathtophpfiles . '/scripts/jobs/hourly/', $debugHandler);
|
||||
}
|
||||
|
||||
/*
|
||||
* include daily jobs (once a day)
|
||||
*/
|
||||
$today = time();
|
||||
if(date('Hi', $today) == '0000')
|
||||
{
|
||||
includeCronjobs($pathtophpfiles . '/scripts/jobs/daily/', $debugHandler);
|
||||
}
|
||||
|
||||
/*
|
||||
* include daily jobs (once a day)
|
||||
*/
|
||||
$today = time();
|
||||
if(date('dHi', $today) == '010000')
|
||||
{
|
||||
includeCronjobs($pathtophpfiles . '/scripts/jobs/monthly/', $debugHandler);
|
||||
}
|
||||
|
||||
includeCronjobs($debugHandler);
|
||||
fwrite($debugHandler, 'Cronfiles have been included' . "\n");
|
||||
|
||||
|
||||
/*
|
||||
* we have to check the system's last guid with every cron run
|
||||
* in case the admin installed new software which added a new user
|
||||
|
Loading…
Reference in New Issue
Block a user