Index: openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-install-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-install-procs.tcl 7 Aug 2017 23:48:29 -0000 1.7 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-install-procs.tcl 1 Mar 2018 08:32:03 -0000 1.8 @@ -1,9 +1,7 @@ -# - ad_library { - + tsearch2 search engine driver installation procedures - + @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-05 @arch-tag: 2006927e-7f1d-41c9-a111-ac552a4da185 @@ -16,101 +14,107 @@ ad_proc -public tsearch2_driver::install::preinstall_checks { } { - + Make sure postgresql_contrib and tsearch are installed before allowing the installation of tsearch2_package - + @author Hamilton Chua (hchua@8tons.dyndns.biz) @creation-date 2004-07-02 - + } { - ns_log Notice " ********** STARTING BEFORE-INSTALL CALLBACK ****************" + ns_log Notice " ********** STARTING BEFORE-INSTALL CALLBACK ****************" - # check if tsearch2 is installed - # in psql we do this by checking the presence of a data type tsvector - # select typname from pg_type where typename='tsvector'; + # check if tsearch2 is installed + # in psql we do this by checking the presence of a data type tsvector + # select typname from pg_type where typename='tsvector'; - if { [db_0or1row tsearch_compile_check { - select distinct(typname) from pg_type where typname='tsvector' - }] } { - # if tsearch is installed - ns_log Notice "******* Tsearch2 is compiled and installed. ***********" - # continue with installation - } else { - - # tsearch not installed - ns_log Notice "******* Tsearch2 is not installed. ***********" + if { [db_0or1row tsearch_compile_check { + select distinct(typname) from pg_type where typname='tsvector' + }] } { + # if tsearch is installed + ns_log Notice "******* Tsearch2 is compiled and installed. ***********" + # continue with installation + } else { - # RPM, Debian, source default locations - set locs [list "/usr/share/pgsql/contrib/tsearch2.sql" \ - "/usr/local/pgsql/contrib/tsearch2.sql" \ - "/usr/local/pgsql/share/contrib/tsearch2.sql" \ - "/usr/share/postgresql/contrib/tsearch2.sql"] - foreach loc $locs { - if { [file exists $loc] } { - set sql_file_loc $loc - break - } - } - # Check if we've found it, run the sql file - if { ([info exists sql_file_loc] && $sql_file_loc ne "") } { - # we found tsearch2.sql let's run it - db_source_sql_file $sql_file_loc - } else { - # we could not find tserach2.sql, abort the install - ns_log Notice "************************************************" - ns_log Notice "********* Can't locate tsearch2.sql. ***********" - ns_log Notice "********* Install tsearch2.sql manually ********" - ns_log Notice "************************************************" - ad_script_abort - } - - } - ns_log Notice " ********** ENDING BEFORE-INSTALL CALLBACK ****************" - + # tsearch not installed + ns_log Notice "******* Tsearch2 is not installed. ***********" + + # RPM, Debian, source default locations + set locs [list "/usr/share/pgsql/contrib/tsearch2.sql" \ + "/usr/local/pgsql/contrib/tsearch2.sql" \ + "/usr/local/pgsql/share/contrib/tsearch2.sql" \ + "/usr/share/postgresql/contrib/tsearch2.sql"] + foreach loc $locs { + if { [file exists $loc] } { + set sql_file_loc $loc + break + } + } + # Check if we've found it, run the sql file + if { [info exists sql_file_loc] && $sql_file_loc ne "" } { + # we found tsearch2.sql let's run it + db_source_sql_file $sql_file_loc + } else { + # we could not find tserach2.sql, abort the install + ns_log Notice "************************************************" + ns_log Notice "********* Can't locate tsearch2.sql. ***********" + ns_log Notice "********* Install tsearch2.sql manually ********" + ns_log Notice "************************************************" + ad_script_abort + } + + } + ns_log Notice " ********** ENDING BEFORE-INSTALL CALLBACK ****************" + } ad_proc -public tsearch2_driver::install::package_install { } { - + Installation callback for tsearch2 search engine driver - + @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-05 - - @error + + @error } { tsearch2_driver::install::register_fts_impl } ad_proc -private tsearch2_driver::install::register_fts_impl { } { - + Register FtsEngineDriver service contract implementation @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-05 - - @return - - @error + + @return + + @error } { set spec { - name "tsearch2-driver" - aliases { - search tsearch2::search - index tsearch2::index - unindex tsearch2::unindex - update_index tsearch2::update_index - summary tsearch2::summary - info tsearch2::driver_info - } - contract_name "FtsEngineDriver" - owner "tsearch2-driver" + name "tsearch2-driver" + aliases { + search tsearch2::search + index tsearch2::index + unindex tsearch2::unindex + update_index tsearch2::update_index + summary tsearch2::summary + info tsearch2::driver_info + } + contract_name "FtsEngineDriver" + owner "tsearch2-driver" } acs_sc::impl::new_from_spec -spec $spec - + } +# +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: