Diff for /loncom/configuration/Configuration.pm between versions 1.10 and 1.14

version 1.10, 2003/04/12 02:45:31 version 1.14, 2007/08/30 20:19:35
Line 38  $VERSION = sprintf("%d.%02d", q$Revision Line 38  $VERSION = sprintf("%d.%02d", q$Revision
   
 use strict;  use strict;
   
 my $confdir='/etc/httpd/conf/';  my @confdirs=('/etc/httpd/conf/','/etc/apache2/');
   
 # ------------------- Subroutine read_conf: read LON-CAPA server configuration.  # ------------------- Subroutine read_conf: read LON-CAPA server configuration.
 # This subroutine reads PerlSetVar values out of specified web server  # This subroutine reads PerlSetVar values out of specified web server
 # configuration files.  # configuration files.
 sub read_conf  sub read_conf {
   {  
     my (@conf_files)=@_;      my (@conf_files)=@_;
     my %perlvar;      my (%perlvar,%configdirs);
     foreach my $filename (@conf_files,'loncapa_apache.conf')      foreach my $filename (@conf_files,'loncapa_apache.conf') {
       {          my $configdir = '';
  open(CONFIG,'<'.$confdir.$filename) or          $configdirs{$filename} = [@confdirs];
     die("Can't read $confdir$filename");          while ($configdir eq '' && @{$configdirs{$filename}} > 0) {
  while (my $configline=<CONFIG>)              my $testdir = shift(@{$configdirs{$filename}});
   {              if (-e $testdir.$filename) {
     if ($configline =~ /^[^\#]*PerlSetVar/)                  $configdir = $testdir;
       {              }
  my ($unused,$varname,$varvalue)=split(/\s+/,$configline);          }
  chomp($varvalue);          if ($configdir eq '') {
  $perlvar{$varname}=$varvalue;              die("Couldn't find a directory containing $filename");
       }          }
   }   &process_file($configdir.$filename,\%perlvar);
  close(CONFIG);   if ($filename eq 'loncapa_apache.conf') {
       }      my @files = glob($configdir.'loncapa_apache_local*.conf');
     my $perlvarref=\%perlvar;      foreach my $file (@files) {
     return ($perlvarref);   &process_file($file,\%perlvar);
   }      }
    }
       }
       return (\%perlvar);
   }
   
   # --------------- Subroutine process_file: helper routine 
   # This subroutine does the actual file reading and reads PerlSetVar discovery
   # specified file, arguments are the filename and a ref to a hash to
   # place the values in
   sub process_file {
       my ($file,$perlvar) = @_;
       open(my $config,'<',$file) or
    die("Can't read $file");
       while (my $configline=<$config>) {
    if ($configline =~ /^[^\#]*PerlSetVar/) {
       my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
       chomp($varvalue);
       $perlvar->{$varname}=$varvalue;
    }
       }
       close($config);
   }
   
 #---------------------- Subroutine read_hosts: Read a LON-CAPA hosts.tab  #---------------------- Subroutine read_hosts: Read a LON-CAPA hosts.tab
 # formatted configuration file.  # formatted configuration file.
Line 94  sub read_hosts { Line 115  sub read_hosts {
  {   {
     my @list = @items; # probably not needed but I'm unsure of       my @list = @items; # probably not needed but I'm unsure of 
     # about the scope of item so...      # about the scope of item so...
     $HostsTab{@list[0]} = \@list;       $HostsTab{$list[0]} = \@list; 
  }   }
     }      }
  }   }

Removed from v.1.10  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>