mirror of
https://github.com/webmin/webmin.git
synced 2026-09-14 01:20:38 +01:00
This PR adds a "Binary Logging" page to configure log format, file size and retention, rotate or purge logs, and support restore sessions that do not write back to binary logs.
26 lines
767 B
Perl
Executable File
26 lines
767 B
Perl
Executable File
#!/usr/local/bin/perl
|
|
# Delete old binary logs from the server
|
|
|
|
require './mysql-lib.pl';
|
|
$access{'perms'} == 1 || &error($text{'binlogs_ecannot'});
|
|
&error_setup($text{'binlogs_purgeerr'});
|
|
&ReadParse();
|
|
|
|
my ($curfile) = &get_binary_log_status();
|
|
$curfile || &error($text{'binlogs_epurgeoff'});
|
|
if ($in{'mode'} == 0) {
|
|
# Purge logs older than some number of days
|
|
$in{'days'} =~ /^\d+$/ && $in{'days'} > 0 ||
|
|
&error($text{'binlogs_epurgedays'});
|
|
&execute_sql_logged($master_db,
|
|
"purge binary logs before date_sub(now(), interval ".
|
|
$in{'days'}." day)");
|
|
}
|
|
else {
|
|
# Purge all logs except the one currently being written
|
|
&execute_sql_logged($master_db,
|
|
"purge binary logs to '".$curfile."'");
|
|
}
|
|
&webmin_log("purgebinlogs");
|
|
&redirect("edit_binlogs.cgi");
|