[open-ils-commits] r14075 - tags/rel_1_6_0_0/Open-ILS/src/perlmods/OpenILS/Application/Search (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 21 11:21:46 EDT 2009


Author: miker
Date: 2009-09-21 11:21:43 -0400 (Mon, 21 Sep 2009)
New Revision: 14075

Modified:
   tags/rel_1_6_0_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
Log:
properly populate %services hash of configured Z servers

Modified: tags/rel_1_6_0_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2009-09-21 15:13:54 UTC (rev 14074)
+++ tags/rel_1_6_0_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm	2009-09-21 15:21:43 UTC (rev 14075)
@@ -86,9 +86,19 @@
 	return $e->event unless $e->checkauth;
 	return $e->event unless $e->allowed('REMOTE_Z3950_QUERY');
 
+	return fetch_service_defs();
+}
+
+# -------------------------------------------------------------------
+# What services do we have config info for?
+# -------------------------------------------------------------------
+sub fetch_service_defs {
+
+    $sclient = OpenSRF::Utils::SettingsClient->new();
     my $hash = $sclient->config_value('z3950', 'services');
 
     # overlay config file values with in-db values
+    my $e = new_editor();
     if($e->can('search_config_z3950_source')) {
 
         my $sources = $e->search_config_z3950_source(
@@ -139,6 +149,7 @@
         }
     };
 
+    %services = %$hash; # cache these internally so we can actually use the db-configured sources
     return $hash;
 }
 
@@ -147,11 +158,9 @@
 # -------------------------------------------------------------------
 # Load the pre-defined Z server configs
 # -------------------------------------------------------------------
-sub initialize {
-	$sclient = OpenSRF::Utils::SettingsClient->new();
-	$default_service = $sclient->config_value("z3950", "default" );
-	my $servs = $sclient->config_value("z3950", "services" );
-	$services{$_} = $$servs{$_} for keys %$servs;
+sub child_init {
+    fetch_service_defs();
+    $default_service = $sclient->config_value("z3950", "default" );
 }
 
 



More information about the open-ils-commits mailing list