mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Cleanup forgotten password link files older than 1 day
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Clean up leftover Webmin temp files and locks, if configured
|
||||
#!/usr/bin/perl
|
||||
# Manually run the temp files cleanup function
|
||||
|
||||
require './cron-lib.pl';
|
||||
&cleanup_temp_files();
|
||||
|
||||
@@ -1608,6 +1608,20 @@ closedir(DIR);
|
||||
foreach (&get_miniserv_websockets_modules()) {
|
||||
&cleanup_miniserv_websockets(undef, $_);
|
||||
}
|
||||
|
||||
# Delete forgot-password files older than 1 day
|
||||
if (opendir(DIR, $main::forgot_password_link_dir)) {
|
||||
my $cutoff = time() - 24*60*60;
|
||||
foreach my $f (readdir(DIR)) {
|
||||
next if ($f eq "." || $f eq "..");
|
||||
my $path = $main::forgot_password_link_dir."/".$f;
|
||||
my @st = stat($path);
|
||||
if ($st[9] < $cutoff) {
|
||||
&unlink_file($path);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
}
|
||||
|
||||
=head2 list_cron_files()
|
||||
|
||||
@@ -11,6 +11,8 @@ eval {
|
||||
'func' => 'cleanup_temp_files',
|
||||
'interval' => 3600 };
|
||||
&webmincron::create_webmin_cron($cron, $temp_delete_cmd);
|
||||
&create_wrapper($module_config_directory."/cleanup.pl",
|
||||
$module_name, "cleanup.pl");
|
||||
};
|
||||
if ($@) {
|
||||
print STDERR "Failed to setup /tmp cleanup cron job : $@\n";
|
||||
|
||||
Reference in New Issue
Block a user