Changeset 97


Ignore:
Timestamp:
May 2, 2003, 9:11:05 PM (18 years ago)
Author:
kake
Message:

Fixed supersearch.cgi to work with MySQL

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r96 r97  
     10.06    2 May 2003
     2        Fixed supersearch.cgi so it works with MySQL as well as Postgres
     3          (thanks again to Bob for finding the bug).
     4
    150.05    2 May 2003
    26        Redid the script and template installation so the script does
  • trunk/supersearch.cgi

    r96 r97  
    1414use Config::Tiny;
    1515
    16 use CGI::Wiki::Store::Pg;
    1716use CGI::Wiki::Search::SII;
    1817use CGI::Wiki::Formatter::UseMod;
     
    2019my $config = Config::Tiny->read('wiki.conf');
    2120
    22 use vars qw($wiki_dbpath $wikimain $css $head
     21use vars qw($store_class $wiki_dbpath $wikimain $css $head
    2322        $wikistore $wiki_search $wiki_formatter %wikitext
    2423        $db_name $db_user $db_pass);
     
    3231$head = $config->{_}->{site_name} . " Search";
    3332
     33# Require in the right database module.
     34my $dbtype = $config->{_}->{dbtype};
     35
     36my %cgi_wiki_exts = ( postgres => "Pg",
     37                      mysql    => "MySQL" );
     38
     39$store_class = "CGI::Wiki::Store::" . $cgi_wiki_exts{$dbtype};
     40eval "require $store_class";
     41die "Can't 'require' $store_class.\n" if $@;
     42
    3443# sub matched_items is called with parse tree. Uses horrible subname concatenation - this
    3544# could be rewritten to us OO instead and be much neater. This would be a major refactor:
     
    8291
    8392# Make store
    84         $wikistore = CGI::Wiki::Store::Pg->new(
     93        $wikistore = $store_class->new(
    8594                dbname => $db_name,
    8695                dbuser => $db_user,
Note: See TracChangeset for help on using the changeset viewer.