mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Clean up schedule backup cron job on DB deletion
This commit is contained in:
@@ -101,3 +101,5 @@ Added confirmation before deleting multiple user, host, database, table and colu
|
||||
Added fields to the Edit User page for setting the maximum concurrent logins and operations per hour for users.
|
||||
Scheduled MySQL backups can now have their success or failure sent via email, via new options on the Backup Database page.
|
||||
When executing SQL or restoring a backup file, the character set can now be selected for the imported data.
|
||||
---- Changes since 1.700 ----
|
||||
When a database is deleted, any cron job for backing it up is also removed.
|
||||
|
||||
@@ -74,3 +74,5 @@ Added greater than / less than selectors to the table data search form.
|
||||
---- Changes since 1.530 ----
|
||||
Added an option to the restore form to limit the restore to only certain tables.
|
||||
When creating a new database, a template database to copy from can now be selected.
|
||||
---- Changes since 1.700 ----
|
||||
When a database is deleted, any cron job for backing it up is also removed.
|
||||
|
||||
@@ -9,6 +9,7 @@ require './postgresql-lib.pl';
|
||||
if ($in{'confirm'}) {
|
||||
# Drop the database
|
||||
&execute_sql_logged($config{'basedb'}, "drop database \"$in{'db'}\"");
|
||||
&delete_database_backup_job($in{'db'});
|
||||
&webmin_log("delete", "db", $in{'db'});
|
||||
&redirect("");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ if ($in{'confirm'}) {
|
||||
# Drop the databases
|
||||
foreach $db (@dbs) {
|
||||
&execute_sql_logged($config{'basedb'}, "drop database \"$db\"");
|
||||
&delete_database_backup_job($db);
|
||||
}
|
||||
&webmin_log("delete", "dbs", scalar(@dbs));
|
||||
&redirect("");
|
||||
|
||||
@@ -1249,5 +1249,21 @@ else {
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# delete_database_backup_job(db)
|
||||
# If there is a backup scheduled for some database, remove it
|
||||
sub delete_database_backup_job
|
||||
{
|
||||
my ($db) = @_;
|
||||
&foreign_require("cron");
|
||||
my @jobs = &cron::list_cron_jobs();
|
||||
my $cmd = "$cron_cmd $db";
|
||||
my ($job) = grep { $_->{'command'} eq $cmd } @jobs;
|
||||
if ($job) {
|
||||
&lock_file(&cron::cron_file($job));
|
||||
&cron::delete_cron_job($job);
|
||||
&unlock_file(&cron::cron_file($job));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user