[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 27 Oct 2003 21:59:35 -0000


matthew		Mon Oct 27 16:59:35 2003 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  First swipe at removing keys from the users profile automatically.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.432 loncom/lonnet/perl/lonnet.pm:1.433
--- loncom/lonnet/perl/lonnet.pm:1.432	Thu Oct 23 17:01:54 2003
+++ loncom/lonnet/perl/lonnet.pm	Mon Oct 27 16:59:34 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.432 2003/10/23 21:01:54 albertel Exp $
+# $Id: lonnet.pm,v 1.433 2003/10/27 21:59:34 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -274,10 +274,19 @@
 	$idf->close();
     }
     my $envi;
+    my %Remove;
     for ($envi=0;$envi<=$#profile;$envi++) {
 	chomp($profile[$envi]);
 	my ($envname,$envvalue)=split(/=/,$profile[$envi]);
 	$ENV{$envname} = $envvalue;
+        if (my ($key,$time) = ($envname =~ /^(cgi\.(\d+)_\d+\.)/)) {
+            if ($time < time-300) {
+                $Remove{$key}++;
+            }
+        }
+    }
+    foreach my $expired_key (keys(%Remove)) {
+        &delenv($expired_key);
     }
     $ENV{'user.environment'} = "$lonidsdir/$handle.id";
 }