[LON-CAPA-cvs] cvs: loncom /metadata_database searchcat.pl

harris41 lon-capa-cvs@mail.lon-capa.org
Sat, 11 May 2002 21:28:21 -0000


harris41		Sat May 11 17:28:21 2002 EDT

  Modified files:              
    /loncom/metadata_database	searchcat.pl 
  Log:
  using LONCAPA::Configuration::read_conf
  BUG 129
  
  
Index: loncom/metadata_database/searchcat.pl
diff -u loncom/metadata_database/searchcat.pl:1.16 loncom/metadata_database/searchcat.pl:1.17
--- loncom/metadata_database/searchcat.pl:1.16	Mon Mar  4 00:06:18 2002
+++ loncom/metadata_database/searchcat.pl	Sat May 11 17:28:20 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # searchcat.pl "Search Catalog" batch script
 #
-# $Id: searchcat.pl,v 1.16 2002/03/04 05:06:18 harris41 Exp $
+# $Id: searchcat.pl,v 1.17 2002/05/11 21:28:20 harris41 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -27,15 +27,20 @@
 # http://www.lon-capa.org/
 #
 # YEAR=2001
-#
 # 04/14/2001, 04/16/2001 Scott Harrison
 #
+# YEAR=2002
+# 05/11/2002 Scott Harrison
+#
 ###
 
 # This script goes through a LON-CAPA resource
 # directory and gathers metadata.
 # The metadata is entered into a SQL database.
 
+use lib '/home/httpd/lib/perl/';
+use LONCAPA::Configuration;
+
 use IO::File;
 use HTML::TokeParser;
 use DBI;
@@ -50,17 +55,11 @@
     push(@metalist,"$dir/$_");
 }
 
-# ------------------------------------ Read httpd access.conf and get variables
-open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf";
-
-while ($configline=<CONFIG>) {
-    if ($configline =~ /PerlSetVar/) {
-	my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);
-        chomp($varvalue);
-        $perlvar{$varname}=$varvalue;
-    }
-}
-close(CONFIG);
+# ------------------------- Read access.conf and loncapa.conf and get variables
+my $perlvarref=LONCAPA::Configuration::read_conf('access.conf','loncapa.conf');
+my %perlvar=%{$perlvarref};
+undef $perlvarref; # remove since sensitive and not needed
+delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
 
 # ------------------------------------- Only run if machine is a library server
 exit unless $perlvar{'lonRole'} eq 'library';