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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 11 May 2007 17:25:29 -0000


raeburn		Fri May 11 13:25:29 2007 EDT

  Modified files:              
    /loncom/enrollment	Autoupdate.pl 
  Log:
  Only run Autoupdate for the domain if the server is the primary library server for the domain. 
  
  
Index: loncom/enrollment/Autoupdate.pl
diff -u loncom/enrollment/Autoupdate.pl:1.4 loncom/enrollment/Autoupdate.pl:1.5
--- loncom/enrollment/Autoupdate.pl:1.4	Tue Apr  3 13:51:52 2007
+++ loncom/enrollment/Autoupdate.pl	Fri May 11 13:25:28 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 # Automated Userinfo update script
-# $Id: Autoupdate.pl,v 1.4 2007/04/03 17:51:52 raeburn Exp $
+# $Id: Autoupdate.pl,v 1.5 2007/05/11 17:25:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,12 +31,19 @@
     use Apache::lonnet;
     use Apache::loncommon;
     use Apache::lonlocal;
+    use LONCAPA::Configuration;
     use LONCAPA;
 
+    my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
+    my $hostid = $perlvarref->{'lonHostID'}; 
     my @info = ('inststatus','lockedname','lastname','firstname','id');
     # find out which users we need to examine
     my @domains = sort(&Apache::lonnet::current_machine_domains());
     foreach my $dom (@domains) {
+        my $primaryhost_id = &Apache::lonnet::domain($dom,'primary');
+        if ($primaryhost_id ne $hostid) {
+            next;
+        } 
         my %domconfig = &Apache::lonnet::get_dom('configuration',['autoupdate'],
                                                  $dom);
         #only run if configured to