[LON-CAPA-cvs] cvs: loncom /enrollment Autoupdate.pl

raeburn raeburn at source.lon-capa.org
Fri Oct 14 14:14:31 EDT 2011


raeburn		Fri Oct 14 18:14:31 2011 EDT

  Modified files:              
    /loncom/enrollment	Autoupdate.pl 
  Log:
  - &descend_tree() - new first arg ($dom).
    - required for exclusion of courseIDs as users when building %users hash
  
  
Index: loncom/enrollment/Autoupdate.pl
diff -u loncom/enrollment/Autoupdate.pl:1.20 loncom/enrollment/Autoupdate.pl:1.21
--- loncom/enrollment/Autoupdate.pl:1.20	Fri Oct 14 17:13:25 2011
+++ loncom/enrollment/Autoupdate.pl	Fri Oct 14 18:14:31 2011
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 # Automated Userinfo update script
-# $Id: Autoupdate.pl,v 1.20 2011/10/14 17:13:25 raeburn Exp $
+# $Id: Autoupdate.pl,v 1.21 2011/10/14 18:14:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -67,7 +67,7 @@
         # get user information
         my (%users,%instusers,%instids);
         my $dir = $Apache::lonnet::perlvar{lonUsersDir}.'/'.$dom;
-        &descend_tree($dir,0,\%users,\%courses);
+        &descend_tree($dom,$dir,0,\%users,\%courses);
         next if (&localenroll::allusers_info($dom,\%instusers,\%instids,\%users) ne 'ok');
         my (%unamechg,%possnames);
         my @types = ('active','future');
@@ -184,7 +184,7 @@
     }
 
 sub descend_tree {
-    my ($dir,$depth,$alldomusers,$coursesref) = @_;
+    my ($dom,$dir,$depth,$alldomusers,$coursesref) = @_;
     if (-d $dir) {
         opendir(DIR,$dir);
         my @contents = grep(!/^\./,readdir(DIR));
@@ -192,10 +192,10 @@
         $depth ++;
         foreach my $item (@contents) {
             if ($depth < 4) {
-                &descend_tree($dir.'/'.$item,$depth,$alldomusers,$coursesref);
+                &descend_tree($dom,$dir.'/'.$item,$depth,$alldomusers,$coursesref);
             } elsif (-e $dir.'/'.$item.'/passwd') {
                 if (ref($coursesref) eq 'HASH') {
-                    next if (exists($coursesref->{$item}));
+                    next if (exists($coursesref->{$dom.'_'.$item}));
                 }
                 $$alldomusers{$item} = '';
             }




More information about the LON-CAPA-cvs mailing list