[LON-CAPA-cvs] cvs: modules /raeburn FIE_usage.pl

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 26 May 2006 18:01:37 -0000


raeburn		Fri May 26 14:01:37 2006 EDT

  Modified files:              
    /modules/raeburn	FIE_usage.pl 
  Log:
  Session token can be found. 
  
  
Index: modules/raeburn/FIE_usage.pl
diff -u modules/raeburn/FIE_usage.pl:1.9 modules/raeburn/FIE_usage.pl:1.10
--- modules/raeburn/FIE_usage.pl:1.9	Fri May 26 11:21:30 2006
+++ modules/raeburn/FIE_usage.pl	Fri May 26 14:01:35 2006
@@ -94,6 +94,7 @@
 my @buffer = <CONFIG>;
 close(CONFIG);
 my %config = ();
+chomp(@buffer);
 foreach my $line (@buffer) {
     my ($key,$value) = split(/:/,$line);
     $config{$key} = $value;
@@ -170,23 +171,23 @@
 print SUMM "ID,CourseCode,Enrollment,Cloned,Items,Problems,Exams,Surveys,Allproblems,Essay,Match,Numerical,Option,Radiobutton,String,Formula,Rank,Images,NumResponses,gnuplot,multipart,Scripts,Functions,Duplicates,Hidden,Encrypted,Conditional,Randompicks,Embedded-res,Embedded-upload,Scantron,Imported,Homegrown,HomeDomain,Uploaded,WithDiscussion,NoDiscussion,TotalPosts,Broadcast,Critical,UserNotes,examupload,Calendar\n";
 
 my $dom = $config{'domain'};
-if (grep/^$dom$/,@domains) {
+if (grep($dom,@domains)) {
     open(LOG,">fie-data-domain-$dom.txt");
     my $dc = $config{'dc'}; 
     my $lonidsdir= $$perlvarref{'lonIDsDir'};
-    opendir(DIR,"<$lonidsdir");
-    my @lonids = readdir(DIR);
+    opendir(DIR,"$lonidsdir");
+    my @lonids = grep(!/^\./,readdir(DIR));
     closedir(DIR);
     my $handle;
     foreach my $file (@lonids) {
-        if ($file =~ /^\Q$dc\E_\d+_\Q$dom\E_\Q$hostid\E$/) {
-            $handle = $file;
+        if ($file =~ /^(\Q$dc\E_\d+_\Q$dom\E_\Q$hostid\E)\.id$/) {
+            $handle = $1;
             last;
         }
     }
     if (!$handle) {
         print "Could not find a session token for $dc in $dom in $lonidsdir on $hostid server\n";
-        return;
+        exit;
     }
     $env{'user.name'} = $dc;
     my $authhost = &Apache::lonnet::homeserver($dc,$dom);