From: luke Date: Thu, 4 Sep 2008 03:28:23 +0000 (-0400) Subject: -a X-Git-Tag: 2.1-alpha-2019-0-29~164 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=8560de0f3eac90850abf75e6685458190aa92278;p=insipid.git -a --- diff --git a/README b/README index 27f0ddc..6ef3702 100755 --- a/README +++ b/README @@ -36,6 +36,5 @@ Once the configuration is finished, access the insipid.cgi through your web browser at the URL you've configured and the database should be automatically configured. -If you ever upgrade Insipid, the database and what not will be -automatically updated upon access. - +If you ever upgrade Insipid, the database schema will be automatically +updated upon access. diff --git a/insipid.cgi b/insipid.cgi index 413476e..c3b2c1e 100755 --- a/insipid.cgi +++ b/insipid.cgi @@ -1,77 +1,84 @@ -#!/usr/bin/perl -# -# Copyright (C) 2006 Luke Reeves -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -# - -use warnings; -use strict; - -# This stub checks for libraries and what not and then calls the main program. -push(@INC, "lib"); - -if(!-e "insipid-config.cgi") { - # TODO: Better error message here. - show_error("Configuration file missing", "The \"insipid-config.cgi\"" . - " file could not be found."); -} - - -eval { - require Insipid::Main; - Insipid::Main::main(); -}; - -if($@) { - my $errstr = $@; - if($errstr =~ /Can\'t locate (.*) in/) { - show_error("Couldn't find the module \"$1\".", "You may want to " . - "search CPAN " . - "for the module or check the " . - "" . - "Insipid homepage for more information."); - } elsif ( - ($errstr =~ /Couldn\'t acquire lock on id/) || - ($errstr =~ /doesn\'t exist/) || - ($errstr =~ /relation \".*\" does not exist/) ) { - # This means that a database connection was established but the - # tables were not found. - eval { - require Insipid::Database; - Insipid::Database::install(); - }; - - if($@) { - show_error("Database error", "There was a problem " . - "creating the database tables required by Insipid."); - } - } else { - print "Content-Type: text/plain\r\n\r\nError: $@\r\n"; - } -} - -sub show_error { - my ($subject, $body) = (@_); - print "Content-Type: text/html\r\n\r\n"; - print "Insipid Error"; - print ""; - print "

$subject

"; - print "

"; - print "

$body"; - print "

"; - exit; -} +#!/usr/bin/perl +# +# Copyright (C) 2006 Luke Reeves +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA +# + +use warnings; +use strict; + +# This stub checks for libraries and what not and then calls the main program. +push(@INC, "lib"); + +if(!-e "insipid-config.cgi") { + # TODO: Better error message here. + show_error("Configuration file missing", "The \"insipid-config.cgi\"" . + " file could not be found."); +} + + +eval { + require Insipid::Main; + Insipid::Main::main(); +}; + +if($@) { + my $errstr = $@; + if($errstr =~ /Can\'t locate (.*) in/) { + show_error("Couldn't find the module \"$1\".", "You may want to " . + "search CPAN " . + "for the module or check the " . + "" . + "Insipid homepage for more information."); + } elsif ( + ($errstr =~ /Couldn\'t acquire lock on id/) || + ($errstr =~ /doesn\'t exist/) || + ($errstr =~ /relation \".*\" does not exist/) ) { + # This means that a database connection was established but the + # tables were not found. + eval { + require Insipid::Database; + Insipid::Database::install(); + }; + + if($@) { + show_error("Database error", "There was a problem " . + "creating the database tables required by Insipid:", + $errstr); + } + } else { + print "Content-Type: text/plain\r\n\r\nError: $@\r\n"; + } +} + +sub show_error { + my ($subject, $body, $error) = (@_); + print "Content-Type: text/html\r\n\r\n"; + print "Insipid Error"; + print ""; + print "

$subject

"; + print "

"; + print "

$body"; + print "

"; + + if(defined($error)) { + print '
' . $error . '
'; + } + + print ''; + exit; +}