mirror of
https://github.com/webmin/webmin.git
synced 2025-07-23 00:30:33 +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";
|
print STDERR "Temp file clearing is disabled\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cleanup files in /tmp/.webmin
|
||||||
if ($gconfig{'tempdir'} && !$gconfig{'tempdirdelete'}) {
|
if ($gconfig{'tempdir'} && !$gconfig{'tempdirdelete'}) {
|
||||||
print STDERR "Temp file clearing is not done for the custom directory $gconfig{'tempdir'}\n";
|
print STDERR "Temp file clearing is not done for the custom directory $gconfig{'tempdir'}\n";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
local $tempdir = &transname();
|
local $tempdir = &transname();
|
||||||
$tempdir =~ s/\/([^\/]+)$//;
|
$tempdir =~ s/\/([^\/]+)$//;
|
||||||
if (!$tempdir || $tempdir eq "/") {
|
if (!$tempdir || $tempdir eq "/") {
|
||||||
$tempdir = "/tmp/.webmin";
|
$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");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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";
|
my $lockdir = $var_directory."/locks";
|
||||||
opendir(DIR, $lockdir);
|
opendir(DIR, $lockdir);
|
||||||
foreach my $f (readdir(DIR)) {
|
foreach my $f (readdir(DIR)) {
|
||||||
@ -1600,6 +1603,12 @@ foreach my $f (readdir(DIR)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(DIR);
|
closedir(DIR);
|
||||||
|
|
||||||
|
# Cleanup old websockets
|
||||||
|
if (&foreign_check("xterm")) {
|
||||||
|
&foreign_require("xterm");
|
||||||
|
&xterm::cleanup_miniserv_websockets();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 list_cron_files()
|
=head2 list_cron_files()
|
||||||
|
Reference in New Issue
Block a user