Bugzilla – Attachment 51671 Details for
Bug 13669
Web installer fails to load sample data on MySQL 5.6+
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13669: Re-adds error handling to load_sql
Bug-13669-Re-adds-error-handling-to-loadsql.patch (text/plain), 1.44 KB, created by
Bernardo Gonzalez Kriegel
on 2016-05-20 17:32:09 UTC
(
hide
)
Description:
Bug 13669: Re-adds error handling to load_sql
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2016-05-20 17:32:09 UTC
Size:
1.44 KB
patch
obsolete
>From 61cd8f9872b3df36b1eea4becf7969a359c48563 Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Fri, 20 May 2016 14:26:14 -0300 >Subject: [PATCH] Bug 13669: Re-adds error handling to load_sql > >This patch prevents crashing in case an >error is detected when loading a file > >To test: >1) Apply patch >2) Mangle kohastructure.sql or any sample >file adding and invalid SQL line >3) Run webinstaller and check that the error >is handled gracefully >--- > C4/Installer.pm | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index 54587de..9ffc396 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -428,18 +428,24 @@ with missing files, e.g. > =cut > > sub load_sql { >- > my $self = shift; > my $filename = shift; >+ my $error; > > my $dbh = $self->{ dbh }; > >- my $error = DBIx::RunSQL->run_sql_file( >- dbh => $dbh, >- sql => $filename, >- ); >- >- $error = ( $error ) ? "ERROR: $filename" : ""; >+ eval { >+ DBIx::RunSQL->run_sql_file( >+ dbh => $dbh, >+ sql => $filename, >+ ); >+ }; >+ # errors thrown while loading installer data should be logged >+ if( $@ ) { >+ warn "C4::Installer::load_sql returned the following errors while attempting to load $filename:\n"; >+ warn "$@"; >+ $error = "Error attempting to load $filename:\n$@"; >+ } > > return $error; > } >-- >1.9.1
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 13669
:
51596
|
51597
|
51598
|
51599
|
51600
|
51601
|
51607
|
51608
|
51610
|
51611
|
51612
|
51671
|
51672
|
51680
|
51681
|
51682
|
51683
|
51684
|
51685
|
51736
|
51738
|
51746