mirror of
https://github.com/webmin/webmin.git
synced 2026-08-24 07:40:31 +01:00
This PR updates the Log File Rotation module for openSUSE Leap 16's split `/usr/etc` and `/etc` configuration model. - Select the local main configuration when present, otherwise use the vendor configuration. - Recursively merge vendor and local drop-ins using the same precedence as `logrotate-all`. - Display vendor configurations while keeping `/usr/etc` read-only. - Copy vendor files into matching `/etc` overrides before editing or deleting them. - Preserve empty overrides so deleted vendor rotations remain disabled. - Use the openSUSE wrapper for scheduled rotation and the effective configuration set for forced rotation. - Keep behavior unchanged on distributions that do not enable the vendor overlay. Includes regression coverage for selection, precedence, copy-on-write, deletion, scheduling, backups, and protection against direct vendor writes. Closes [#2682](https://github.com/webmin/webmin/issues/2682).
46 lines
1022 B
Perl
Executable File
46 lines
1022 B
Perl
Executable File
#!/usr/local/bin/perl
|
|
# save_sched.cgi
|
|
# Create, update or delete the rotation cron job
|
|
|
|
require './logrotate-lib.pl';
|
|
&ReadParse();
|
|
|
|
&foreign_require("cron", "cron-lib.pl");
|
|
@jobs = &cron::list_cron_jobs();
|
|
if ($in{'idx'} ne "") {
|
|
$oldjob = $job = $jobs[$in{'idx'}];
|
|
}
|
|
else {
|
|
# Prefer the distro wrapper, when available, so future runs discover the
|
|
# then-current vendor and local drop-in set.
|
|
$job = { 'user' => 'root',
|
|
'command' => &get_scheduled_logrotate_command(),
|
|
'active' => 1 };
|
|
}
|
|
&lock_file(&cron::cron_file($job));
|
|
|
|
&error_setup($text{'sched_err'});
|
|
&cron::parse_times_input($job, \%in) if ($in{'sched'});
|
|
|
|
if ($oldjob && $in{'sched'}) {
|
|
# Just update
|
|
&cron::change_cron_job($job);
|
|
$action = "modify";
|
|
}
|
|
elsif ($oldjob && !$in{'sched'}) {
|
|
# Delete
|
|
&cron::delete_cron_job($job);
|
|
$action = "delete";
|
|
}
|
|
elsif (!$oldjob && $in{'sched'}) {
|
|
# Create new
|
|
&cron::create_cron_job($job);
|
|
$action = "create";
|
|
}
|
|
|
|
&unlock_file(&cron::cron_file($job));
|
|
&webmin_log($action, "sched");
|
|
|
|
&redirect("");
|
|
|