mirror of
https://github.com/webmin/webmin.git
synced 2025-07-21 23:40:34 +00:00
Also cleanup websockets
This commit is contained in:
@ -1567,28 +1567,31 @@ if (!$gconfig{'tempdelete_days'}) {
|
||||
print STDERR "Temp file clearing is disabled\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Cleanup files in /tmp/.webmin
|
||||
if ($gconfig{'tempdir'} && !$gconfig{'tempdirdelete'}) {
|
||||
print STDERR "Temp file clearing is not done for the custom directory $gconfig{'tempdir'}\n";
|
||||
return;
|
||||
}
|
||||
|
||||
local $tempdir = &transname();
|
||||
$tempdir =~ s/\/([^\/]+)$//;
|
||||
if (!$tempdir || $tempdir eq "/") {
|
||||
$tempdir = "/tmp/.webmin";
|
||||
}
|
||||
|
||||
local $cutoff = time() - $gconfig{'tempdelete_days'}*24*60*60;
|
||||
opendir(DIR, $tempdir);
|
||||
foreach my $f (readdir(DIR)) {
|
||||
next if ($f eq "." || $f eq "..");
|
||||
local @st = lstat("$tempdir/$f");
|
||||
if ($st[9] < $cutoff) {
|
||||
&unlink_file("$tempdir/$f");
|
||||
else {
|
||||
local $tempdir = &transname();
|
||||
$tempdir =~ s/\/([^\/]+)$//;
|
||||
if (!$tempdir || $tempdir eq "/") {
|
||||
$tempdir = "/tmp/.webmin";
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
local $cutoff = time() - $gconfig{'tempdelete_days'}*24*60*60;
|
||||
opendir(DIR, $tempdir);
|
||||
foreach my $f (readdir(DIR)) {
|
||||
next if ($f eq "." || $f eq "..");
|
||||
local @st = lstat("$tempdir/$f");
|
||||
if ($st[9] < $cutoff) {
|
||||
&unlink_file("$tempdir/$f");
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
# Delete stale lock files
|
||||
my $lockdir = $var_directory."/locks";
|
||||
opendir(DIR, $lockdir);
|
||||
foreach my $f (readdir(DIR)) {
|
||||
@ -1600,6 +1603,12 @@ foreach my $f (readdir(DIR)) {
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
# Cleanup old websockets
|
||||
if (&foreign_check("xterm")) {
|
||||
&foreign_require("xterm");
|
||||
&xterm::cleanup_miniserv_websockets();
|
||||
}
|
||||
}
|
||||
|
||||
=head2 list_cron_files()
|
||||
|
Reference in New Issue
Block a user