[LON-CAPA-cvs] cvs: loncom /enrollment Autoupdate.pl
raeburn
raeburn@source.lon-capa.org
Fri, 26 Mar 2010 13:19:04 -0000
raeburn Fri Mar 26 13:19:04 2010 EDT
Modified files:
/loncom/enrollment Autoupdate.pl
Log:
- Check directory in lonUsers/$dom/$1/$2/$3/$uname is for a real user
by testing for existence of passwd file.
- Coding style
- Use lonRole perl Var to check if current server is a library server.
Index: loncom/enrollment/Autoupdate.pl
diff -u loncom/enrollment/Autoupdate.pl:1.18 loncom/enrollment/Autoupdate.pl:1.19
--- loncom/enrollment/Autoupdate.pl:1.18 Thu Mar 25 04:36:02 2010
+++ loncom/enrollment/Autoupdate.pl Fri Mar 26 13:19:04 2010
@@ -1,7 +1,7 @@
#!/usr/bin/perl
#
# Automated Userinfo update script
-# $Id: Autoupdate.pl,v 1.18 2010/03/25 04:36:02 raeburn Exp $
+# $Id: Autoupdate.pl,v 1.19 2010/03/26 13:19:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,11 +36,11 @@
use LONCAPA;
my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
- my $logfile = $$perlvarref{'lonDaemons'}.'/logs/autoupdate.log';
+ exit if (ref($perlvarref) ne 'HASH');
+ my $logfile = $perlvarref->{'lonDaemons'}.'/logs/autoupdate.log';
+ exit if ($perlvarref->{'lonRole'} ne 'library');
my $hostid = $perlvarref->{'lonHostID'};
- if (!&Apache::lonnet::is_library($hostid)) {
- exit;
- }
+
my @info = ('inststatus','lockedname','internalname','lastname',
'firstname','middlename','generation','id','permanentemail');
# Initialize language handler
@@ -194,7 +194,7 @@
foreach my $item (@contents) {
if ($depth < 4) {
&descend_tree($dir.'/'.$item,$depth,$alldomusers);
- } else {
+ } elsif (-e $dir.'/'.$item.'/passwd') {
$$alldomusers{$item} = '';
}
}