Changeset 60


Ignore:
Timestamp:
Apr 24, 2003, 5:26:38 PM (19 years ago)
Author:
kake
Message:

Rejigged in preparation for supporting mysql and sqlite

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Build.PL

    r59 r60  
    3535},
    3636{ question =>
    37         "what's the name of the postgres database that this site runs on?",
     37        "what's the name of the database that this site runs on?",
    3838  variable => "dbname"
    3939},
     
    8282
    8383my @answers;
     84
     85# Database type is speshull - can be one of three.
     86my $dbtype;
     87my $dbtype_qu = "what type of database do you want the site to run on?  postgres/mysql/sqlite";
     88if ( $skip_config ) {
     89    $dbtype = $existing_config{dbtype} || "postgres";
     90} else {
     91    until ( $dbtype ) {
     92        my $def = $existing_config{dbtype} || "postgres";
     93        $dbtype = Module::Build->prompt("\n$dbtype_qu", $def);
     94        $dbtype = lc($dbtype);
     95        $dbtype =~ s/^\s*//;
     96        $dbtype =~ s/\s*$//;
     97        unless ( $dbtype eq "postgres" or $dbtype eq "mysql"
     98                 or $dbtype eq "sqlite" ) {
     99            undef $dbtype;
     100        }
     101    }
     102}
     103push @answers, { question => $dbtype_qu,
     104                 variable => "dbtype",
     105                 value    => $dbtype };
     106
    84107foreach my $qset (@questions) {
    85108    my $qu  = $qset->{question};
  • trunk/lib/OpenGuides/Build.pm

    r59 r60  
    55use base 'Module::Build';
    66
    7 eval "use Config::Tiny";
    8 die "Config::Tiny is required to configure this application.\n" if $@;
    9 
    10 eval "use CGI::Wiki::Setup::Pg";
    11 die "CGI::Wiki is required to set up this application.\n" if $@;
    12 
    13 my $config = Config::Tiny->read("wiki.conf");
    14 my $dbname = $config->{_}->{dbname};
    15 my $dbuser = $config->{_}->{dbuser};
    16 my $dbpass = $config->{_}->{dbpass};
    17 my $dbhost = $config->{_}->{dbhost};
    18 
    197sub ACTION_install {
    208    my $self = shift;
    219    $self->SUPER::ACTION_install;
     10
     11    eval "use Config::Tiny";
     12    die "Config::Tiny is required to set up this application.\n" if $@;
     13
     14    eval "use CGI::Wiki::Setup::Pg";
     15    die "CGI::Wiki is required to set up this application.\n" if $@;
     16
     17    my $config = Config::Tiny->read("wiki.conf");
     18    my $dbname = $config->{_}->{dbname};
     19    my $dbuser = $config->{_}->{dbuser};
     20    my $dbpass = $config->{_}->{dbpass};
     21    my $dbhost = $config->{_}->{dbhost};
     22
    2223    print "Checking database schema...\n";
    2324    CGI::Wiki::Setup::Pg::setup( $dbname, $dbuser, $dbpass, $dbhost );
Note: See TracChangeset for help on using the changeset viewer.