enhance master-cronjob parameter usage, you can now use --force-[cronname] to force any cronjob you like; now show mailbox sizes of emial accounts in the customers email overview, fixes #1007

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-09-23 16:58:27 +02:00
parent f9f4773616
commit 2a396ffb31
9 changed files with 77 additions and 16 deletions

View File

@@ -19,23 +19,41 @@ include_once(dirname(__FILE__) . '/../lib/cron_init.php');
$jobs_to_run = includeCronjobs($debugHandler, $pathtophpfiles);
/**
* check for --help
*/
if (isset($argv[1]) && strtolower($argv[1]) == '--help') {
echo "\n*** Froxlor Master Cronjob ***\n\n";
echo "Below are possible parameters for this file\n\n";
echo "--force\t\t\tforces re-generating of config-files (webserver, etc.)\n";
echo "--force-[cronname]\tforces the given cron to run, e.g. --force-backup, --force-traffic\n\n";
}
/**
* check for --force to include cron_tasks
* even if it's not its turn
*/
if(isset($argv[1]) && strtolower($argv[1]) == '--force')
{
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_tasks.php');
// really force re-generating of config-files by
// inserting task 1
inserttask('1');
if (!in_array($crontasks, $jobs_to_run)) {
array_unshift($jobs_to_run, $crontasks);
for ($x = 1; $x < count($argv); $x++) {
if (isset($argv[$x]) && strtolower($argv[$x]) == '--force') {
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_tasks.php');
// really force re-generating of config-files by
// inserting task 1
inserttask('1');
if (!in_array($crontasks, $jobs_to_run)) {
array_unshift($jobs_to_run, $crontasks);
}
}
elseif (isset($argv[$x]) && substr(strtolower($argv[$x]), 0, 8) == '--force-') {
$crontasks = makeCorrectFile($pathtophpfiles.'/scripts/jobs/cron_'.substr(strtolower($argv[$x]), 8).'.php');
if (file_exists($crontasks)) {
if (!in_array($crontasks, $jobs_to_run)) {
array_unshift($jobs_to_run, $crontasks);
}
}
}
}
foreach($jobs_to_run as $cron)
{
foreach ($jobs_to_run as $cron) {
require_once($cron);
}
@@ -53,5 +71,3 @@ checkLastGuid();
* shutdown cron
*/
include_once($pathtophpfiles . '/lib/cron_shutdown.php');
?>