--- loncom/lonnet/perl/lonnet.pm 2007/04/04 00:07:07 1.862 +++ loncom/lonnet/perl/lonnet.pm 2007/04/04 00:48:23 1.864 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.862 2007/04/04 00:07:07 albertel Exp $ +# $Id: lonnet.pm,v 1.864 2007/04/04 00:48:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -671,61 +671,6 @@ sub homeserver { return 'no_host'; } -# ---------------------- Get domain configuration for a domain -sub get_domainconf { - my ($udom) = @_; - my $cachetime=1800; - my ($result,$cached)=&is_cached_new('domainconfig',$udom); - if (defined($cached)) { return %{$result}; } - - if ($udom eq '') { - $udom = &Apache::loncommon::determinedomain(); - } - my %domconfig = &get_dom('configuration',['login','rolecolors'],$udom); - my %designhash; - if (keys(%domconfig) > 0) { - if (ref($domconfig{'login'}) eq 'HASH') { - foreach my $key (keys(%{$domconfig{'login'}})) { - $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; - } - } - if (ref($domconfig{'rolecolors'}) eq 'HASH') { - foreach my $role (keys(%{$domconfig{'rolecolors'}})) { - if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') { - foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) { - $designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item}; - } - } - } - } - } else { - my $designdir=$perlvar{'lonTabDir'}.'/lonDomColors'; - my $designfile = $designdir.'/'.$udom.'.tab'; - if (-e $designfile) { - if ( open (my $fh,"<$designfile") ) { - while (my $line = <$fh>) { - next if ($line =~ /^\#/); - chomp($line); - my ($key,$val)=(split(/\=/,$line)); - if ($val) { $designhash{$udom.'.'.$key}=$val; } - } - close($fh); - } - } - if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') { - $designhash{$udom.'.login.domlogo'} = - &lonhttpdurl("/adm/lonDomLogos/$udom.gif"); - } - } - &do_cache_new('domainconfig',$udom,\%designhash,$cachetime); - return %designhash; -} - -sub devalidate_domconfig_cache { - my ($udom)=@_; - &devalidate_cache_new('domainconfig',$udom); -} - # ------------------------------------- Find the usernames behind a list of IDs sub idget { @@ -7740,7 +7685,12 @@ sub get_dns { $domain{$name} = \%this_domain; } } - + + sub reset_domain_info { + undef($loaded); + undef(%domain); + } + sub load_domain_tab { &get_dns('/adm/dns/domain',\&parse_domain_tab); my $fh; @@ -7788,6 +7738,15 @@ sub get_dns { } } } + + sub reset_hosts_info { + &reset_domain_info(); + &reset_hosts_ip_info(); + undef(%hostname); + undef(%hostdom); + undef(%libserv); + undef($loaded); + } sub load_hosts_tab { &get_dns('/adm/dns/hosts',\&parse_hosts_tab); @@ -7874,6 +7833,12 @@ sub get_dns { } return; } + + sub reset_hosts_ip_info { + undef(%iphost); + undef(%name_to_ip); + undef(%lonid_to_ip); + } sub get_host_ip { my ($lonid) = @_; @@ -7893,7 +7858,7 @@ sub get_dns { if (%iphost) { return %iphost; } my %hostname = &all_hostnames(); foreach my $id (keys(%hostname)) { - my $name=$hostname{$id}; + my $name=&hostname($id); my $ip; if (!exists($name_to_ip{$name})) { $ip = gethostbyname($name);