From 5199a8ff9927b51c4c16dac4ac7c0036423cc63c Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 30 Mar 2013 09:28:16 -0400 Subject: [PATCH] Bug 9941: Web installer should give error message when db connection fails To test: 1) Point Koha at a database that does not exist in koha-conf.xml. 2) Start up web installer. 3) Watch web installer crash and burn. 4) Apply patch. 5) Start up web installer. 6) Watch the web installer tell you it failed to connect without any sort of horrible error message. Signed-off-by: Chris Cormack --- installer/install.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/installer/install.pl b/installer/install.pl index 58388cb..67b8f3a 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -20,6 +20,15 @@ my $step = $query->param('step'); my $language = $query->param('language'); my ( $template, $loggedinuser, $cookie ); +eval { + my $dbh = C4::Context->dbh; +}; + +if ($@) { + print "Unable to connect to database. Please check your database configuration in koha-conf.xml"; + exit; +} + my $all_languages = getAllLanguages(); if ( defined($language) ) { -- 1.7.10.4