2 # Mass schedule or de-schedule a bunch of logs
4 require './webalizer-lib.pl';
5 &foreign_require("cron", "cron-lib.pl");
7 &error_setup($text{'mass_err'});
8 $access{'view'} && &error($text{'edit_ecannot'});
11 @d = split(/\0/, $in{'d'});
12 @d || &error($text{'mass_enone'});
13 @jobs = &cron::list_cron_jobs();
15 &can_edit_log($file) || &error($text{'edit_efilecannot'});
16 ($job{$file}) = grep { $_->{'command'} eq "$cron_cmd $file" } @jobs;
21 # Add cron jobs for selected
23 $cfile = &config_file_name($file);
24 $lconf = &get_log_config($file);
25 if (!$lconf->{'sched'}) {
27 $lconf->{'sched'} = 1;
30 $job = { 'user' => 'root',
32 'command' => "$cron_cmd $file" };
33 &lconf_to_cron($lconf, $job);
34 &lock_file(&cron::cron_file($job));
35 &cron::create_cron_job($job);
36 &unlock_file(&cron::cron_file($job));
38 &save_log_config($file, $lconf);
43 &webmin_log("enable", "logs", $count);
46 # Cancel cron jobs for selected
48 $cfile = &config_file_name($file);
49 $lconf = &get_log_config($file);
50 if ($lconf->{'sched'}) {
52 $lconf->{'sched'} = 0;
55 &lock_file(&cron::cron_file($job));
56 &cron::delete_cron_job($job);
57 &unlock_file(&cron::cron_file($job));
59 &save_log_config($file, $lconf);
64 &webmin_log("disable", "logs", $count);