Bugzilla – Attachment 13455 Details for
Bug 9085
Installer will not run with DEBUG set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9085 - Installer will not run with DEBUG set
Bug-9085---Installer-will-not-run-with-DEBUG-set.patch (text/plain), 2.10 KB, created by
Chris Nighswonger
on 2012-11-14 20:41:11 UTC
(
hide
)
Description:
Bug 9085 - Installer will not run with DEBUG set
Filename:
MIME Type:
Creator:
Chris Nighswonger
Created:
2012-11-14 20:41:11 UTC
Size:
2.10 KB
patch
obsolete
>From 6506fbcc1e3d763311d49e2f4ea8a9d6b3425b92 Mon Sep 17 00:00:00 2001 >From: Chris Nighswonger <cnighswonger@foundations.edu> >Date: Wed, 14 Nov 2012 15:36:21 -0500 >Subject: [PATCH] Bug 9085 - Installer will not run with DEBUG set >Content-Type: text/plain; charset="utf-8" > >This is due to raising all db errors combined with the fact that attempts >to make selections from a non-existent systempreferences table raises db errors. > >The installer should run even with DEBUG set, otherwise dropping and recreating >a development database becomes somewhat of a chore. This patch adds code to >check for the existence of the systempreferece table. If the table exists, then >RaiseError is enabled on the database handle. Otherwise it is disabled to allow >the installer to run without throwing an error. >--- > C4/Context.pm | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 7de3f94..bd1f235 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -787,8 +787,23 @@ sub _new_dbh > my $db_user = $context->config("user"); > my $db_passwd = $context->config("pass"); > # MJR added or die here, as we can't work without dbh >- my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", >+ my $dbh = DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", > $db_user, $db_passwd, {'RaiseError' => $ENV{DEBUG}?1:0 }) or die $DBI::errstr; >+ >+ # Check for the existence of a systempreference table; if we don't have this, we don't >+ # have a valid database and should not set RaiseError in order to allow the installer >+ # to run; installer will not run otherwise since we raise all db errors >+ >+ eval { >+ local $dbh->{PrintError} = 0; >+ local $dbh->{RaiseError} = 1; >+ $dbh->do(qq{SELECT * FROM systempreferences WHERE 1 = 0 }); >+ }; >+ >+ if ($@) { >+ $dbh->{RaiseError} = 0; >+ } >+ > my $tz = $ENV{TZ}; > if ( $db_driver eq 'mysql' ) { > # Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9085
:
13455
|
13459
|
13547