diff options
author | Ralph Amissah <ralph@amissah.com> | 2013-05-30 23:09:13 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2013-05-30 23:09:13 -0400 |
commit | 9f4d9a3118b97992eeb73845f32dbb282d4cef86 (patch) | |
tree | e76d78cd942a2bbfa66a555e95b237d6b7f5c939 /lib/sisu/v5 | |
parent | v4 v5: sysenv, pgsql db connect fix (diff) |
v4 v5: cgi_pgsql, cgi helper script sample search form generator, detailsisu_4.1.3
Diffstat (limited to 'lib/sisu/v5')
-rw-r--r-- | lib/sisu/v5/cgi_pgsql.rb | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 45a4aae9..9ae9d191 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -73,11 +73,6 @@ module SiSU_CGI_PgSQL get_init=SiSU_Env::GetInit.new @rc=get_init.sisu_yaml.rc @name_of={} - if defined? @rc['webserv'] \ - and defined? @rc['webserv']['url_root'] \ - and defined? @rc['webserv']['url_root'] =~/\S+/ - @name_of[:host_url_docs]=@rc['webserv']['url_root'] - end @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ @rc['output_dir_structure_by'] @@ -90,20 +85,18 @@ module SiSU_CGI_PgSQL and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ @name_of[:db]=@rc['search']['sisu']['db'] - #@name_of[:cgi_script]=/https?:\/\/\S+?([^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] - @name_of[:host_url_cgi]=/(https?:\/\/\S+?)\/(?:[^\/]+?)\.cgi$/.match(@rc['search']['sisu']['action'])[1] else - @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:db]=@env.path.stub_pwd #'sisu' #breaks if not present - @name_of[:host_url_cgi]=@env.url.webserv_base_cgi(@opt) false end + @name_of[:host_url_cgi]="#{@env.url.webserv_base_cgi(@opt)}/cgi-bin" + @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:cgi_script]=@env.url.cgi_sample_search_form_name(@opt) + @name_of[:user]=@db.psql.user(@opt) @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" @cgi_link_name=@name_of[:cgi_script] #sisu_pgsql.cgi, @image_src="#{@env.url.webserv_base_cgi(@opt)}/_sisu/image_sys" @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) - @user=@db.psql.user(@opt) end def pgsql serve=[] @@ -130,14 +123,14 @@ module SiSU_CGI_PgSQL puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} default database name: #{@cX.green}#{Db[:name_prefix]}#{@name_of[:db]}#{@cX.off} (#{@name_of[:db]}) - db user: #{@cX.green}#{@db.psql.user(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@db.psql.user(@opt)}'#{@cX.off} - cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} - sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@env.url.webserv_files_from_db(@opt)}'#{@cX.off} - cgi search form link name: #{@cX.green}#{@env.url.cgi_sample_search_form_name(@opt)}#{@cX.off} - to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@env.url.cgi_sample_search_form_name(@opt)}'#{@cX.off} + db user: #{@cX.green}#{@name_of[:user]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --db-user='#{@name_of[:user]}'#{@cX.off} + cgi & db host on: #{@cX.blue}#{@name_of[:host_url_cgi]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-search='#{@name_of[:host_url_cgi]}'#{@cX.off} + sisu output on: #{@cX.blue}#{@name_of[:host_url_docs]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --webserv-output='#{@name_of[:host_url_docs]}'#{@cX.off} + cgi search form link name: #{@cX.green}#{@name_of[:cgi_script]}#{@cX.off} + to modify use: #{@cX.brown}sisu --db-pg --cgi-search-form-name='#{@name_of[:cgi_script]}'#{@cX.off} #{@cX.fuschia}(settings priority: command line; sisurc.yml; else defaults)#{@cX.off} #{@cX.fuschia}BASED ON ALREADY EXISTING databases#{@cX.off} (default database name: #{@db.psql.db}) @@ -206,13 +199,13 @@ module SiSU_CGI_PgSQL require 'dbi' @stub_default='#{@name_of[:db]}' @image_src='#{@image_src}' - @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' - @hosturl_files='#{@env.url.webserv_files_from_db(@opt)}' + @hosturl_cgi='#{@name_of[:host_url_cgi]}' + @hosturl_files='#{@name_of[:host_url_docs]}' @output_dir_structure_by='#{@name_of[:output_dir_structure]}' @port='#{@db.psql.port}' @db_name_prefix='#{Db[:name_prefix]}' - @user='#{@user}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' - @base='#{@name_of[:host_url_cgi]}/cgi-bin/#{@name_of[:cgi_script]}.cgi' #fix sqlite + @user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' + @base='#{@name_of[:host_url_cgi]}/#{@name_of[:cgi_script]}' WOK_SQL end def search_statement |