# USA
#
+use Data::Dumper;
use warnings;
use strict;
show_error("Couldn't find the module \"$1\".", "You may want to " .
"<a href=\"http://search.cpan.org/\">search CPAN</a> " .
"for the module or check the " .
- "<a href=\"http://www.neuro-tech.net/insipid/\">" .
+ "<a href=\"https://neuro-tech.net/insipid/\">" .
"Insipid</a> homepage for more information.",
$errstr);
} elsif (
($errstr =~ /doesn\'t exist/) ||
($errstr =~ /relation \".*\" does not exist/) ) {
+ print STDERR "Creating database\n";
+
+ #print STDERR Dumper(\%INC);
+ #delete $INC{'Insipid/Database.pm'};
+
# This means that a database connection was established but the
# tables were not found.
undef($@);
};
if($@) {
+ $errstr = $@;
show_error("Database error", "There was a problem " .
"creating the database tables required by Insipid:",
$errstr);
\r
my %options;\r
\r
-my $sql = "select name, value from $tbl_options";\r
-my $sth = $dbh->prepare($sql);\r
-$sth->execute() or return 1; #die $DBI::errstr;\r
-\r
-while(my $hr = $sth->fetchrow_hashref) {\r
- $options{$hr->{'name'}} = $hr->{'value'};\r
-}\r
-\r
-if(need_upgrade() eq 1) {\r
- dbupgrade();\r
-}\r
+#if(need_upgrade() eq 1) {\r
+# dbupgrade();\r
+#}\r
\r
sub export_options {\r
my ($writer) = (@_);\r
# Functions\r
\r
sub get_option {\r
+ if(keys (%options) == 0) {\r
+ my $sql = "select name, value from $tbl_options";\r
+ my $sth = $dbh->prepare($sql);\r
+ $sth->execute() or die $DBI::errstr;\r
+\r
+ while(my $hr = $sth->fetchrow_hashref) {\r
+ $options{$hr->{'name'}} = $hr->{'value'};\r
+ }\r
+ $sth->close();\r
+ }\r
+\r
my ($name) = (@_);\r
return $options{$name};\r
}\r
\r
sub install {\r
my ($sth, @creates);\r
+\r
+ print STDERR "Performing database installation.\n";\r
\r
print "Content-Type: text/html\r\n\r\n";\r
print "<html><head><title>Insipid Installation</title></head><body>";\r
# Insipid will check the database version number on each initialization of\r
# the options table (every hit essentially) and upgrade the tables if there's\r
# any mismatch.\r
-our $version = "0.9.19";\r
+our $version = "0.9.20";\r
\r
our $createPostgres = <<CPOSTGRES;\r
CREATE TABLE $tbl_authentication (\r