From 45e9e184ef1bf291f824aa56d1fe3c1e3b489a82 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sat, 29 Sep 2007 13:04:18 -0500 Subject: [PATCH] genericize spsuggest feature Signed-off-by: Chris Cormack --- catalogue/search.pl | 3 ++- installer/data/en/mandatory/sysprefs.sql | 2 +- opac/opac-search.pl | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 61efef2fa7..a236d57d9b 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -505,11 +505,12 @@ my $phrases = $search_desc; my $ipaddress; if ( C4::Context->preference("kohaspsuggest") ) { + my ($suggest_host, $suggest_dbname, $suggest_user, $suggest_pwd) = split(':', C4::Context->preference("kohaspsuggest")); eval { my $koha_spsuggest_dbh; # FIXME: this needs to be moved to Context.pm eval { - $koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.76","auth","Free2cirC"); + $koha_spsuggest_dbh=DBI->connect("DBI:mysql:$suggest_dbname:$suggest_host","$suggest_user","$suggest_pwd"); }; if ($@) { warn "can't connect to spsuggest db"; diff --git a/installer/data/en/mandatory/sysprefs.sql b/installer/data/en/mandatory/sysprefs.sql index 89d504faeb..65e0d5554d 100644 --- a/installer/data/en/mandatory/sysprefs.sql +++ b/installer/data/en/mandatory/sysprefs.sql @@ -40,7 +40,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('item-level_itypes','1','Item-level Itemtype / issuing rules','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemcallnumber','676a','The MARC field/subfield that is used to calculate the itemcallnumber (in UNIMARC',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('KohaAdminEmailAddress','root@localhost','the email address where borrowers modifs are sent','','free'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('kohaspsuggest','1','Keep track of queries and suggestions in a database','',''); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('kohaspsuggest','','Track search queries, turn on by specifying host:dbname:user:pass','',''); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('LabelMARCView','standard','Define how a MARC record will display','standard|economical','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('LetterLog','0','Active this if you want to log all the letter sent',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('LibraryName','','Library name as shown on main opac page','',''); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 75f265c640..320336facc 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -553,14 +553,13 @@ my $phrases = $search_desc; my $ipaddress; if ( C4::Context->preference("kohaspsuggest") ) { + my ($suggest_host, $suggest_dbname, $suggest_user, $suggest_pwd) = split(':', C4::Context->preference("kohaspsuggest")); eval { my $koha_spsuggest_dbh; # FIXME: this needs to be moved to Context.pm eval { - $koha_spsuggest_dbh = - DBI->connect( "DBI:mysql:suggest:66.213.78.76", - "auth", "Free2cirC" ); + $koha_spsuggest_dbh=DBI->connect("DBI:mysql:$suggest_dbname:$suggest_host","$suggest_user","$suggest_pwd"); }; if ($@) { warn "can't connect to spsuggest db"; -- 2.39.5