diff options
Diffstat (limited to 'Echolot')
-rw-r--r-- | Echolot/Config.pm | 3 | ||||
-rw-r--r-- | Echolot/Thesaurus.pm | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 8c62451..140e22d 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Config.pm,v 1.15 2002/07/06 21:35:04 weasel Exp $ +# $Id: Config.pm,v 1.16 2002/07/07 00:42:46 weasel Exp $ # =pod @@ -94,6 +94,7 @@ sub init($) { expire_keys => 5*24*60*60, # 5 days expire_confs => 5*24*60*60, # 5 days expire_pings => 12*24*60*60, # 12 days + expire_thesaurus => 21*24*60*60, # 21 days storage => { backend => 'File', File => { diff --git a/Echolot/Thesaurus.pm b/Echolot/Thesaurus.pm index a150367..2e0d6cd 100644 --- a/Echolot/Thesaurus.pm +++ b/Echolot/Thesaurus.pm @@ -1,7 +1,7 @@ package Echolot::Thesaurus; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Thesaurus.pm,v 1.3 2002/07/06 20:15:12 weasel Exp $ +# $Id: Thesaurus.pm,v 1.4 2002/07/07 00:42:46 weasel Exp $ # =pod @@ -33,6 +33,9 @@ sub build_thesaurus() { my @files = grep { ! /^\./ } readdir(DIR); closedir(DIR); + + my $exire_date = time() - Echolot::Config::get()->{'expire_thesaurus'}; + my $data; for my $filename (@files) { my ($id, $what) = $filename =~ /^(\d+)-(adminkey|conf|help|key|stats)$/; @@ -45,6 +48,14 @@ sub build_thesaurus() { $atime,$mtime,$ctime,$blksize,$blocks) = stat($dir.'/'.$filename); + if ($mtime < $expire_date) { + unlink ($filename) or + cluck("Cannot unlink expired $filename"); + print ("Expired thesaurus file $filename\n") if + Echolot::Config::get()->{'verbose'}; + next; + }; + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime($mtime); @@ -110,5 +121,6 @@ sub build_thesaurus() { close (F); }; + 1; # vim: set ts=4 shiftwidth=4: |