Bugzilla – Attachment 75930 Details for
Bug 13897
Use YAML files for installer data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13897: C4/Installer.pm - process XML files
Bug-13897-C4Installerpm---process-XML-files.patch (text/plain), 2.20 KB, created by
Bernardo Gonzalez Kriegel
on 2018-06-08 17:08:26 UTC
(
hide
)
Description:
Bug 13897: C4/Installer.pm - process XML files
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2018-06-08 17:08:26 UTC
Size:
2.20 KB
patch
obsolete
>From b26174ba0aa0f2ca7d475a8598e0fffc867593bd Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Fri, 8 Jun 2018 08:23:34 -0300 >Subject: [PATCH] Bug 13897: C4/Installer.pm - process XML files > >This patch modifies C4/Installer.pm to add support >for processing of XML files into database. >For MySQL only >--- > C4/Installer.pm | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index 1a5c037a42..a9a3e8d554 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -21,6 +21,7 @@ use Modern::Perl; > > use Encode qw( encode is_utf8 ); > use DBIx::RunSQL; >+use XML::LibXML; > use C4::Context; > use C4::Installer::PerlModules; > use DBI; >@@ -145,7 +146,7 @@ sub marc_framework_sql_list { > > foreach my $requirelevel (@listdir) { > opendir( MYDIR, "$dir/$requirelevel" ); >- my @listname = grep { !/^\./ && -f "$dir/$requirelevel/$_" && $_ =~ m/\.sql$/ } readdir(MYDIR); >+ my @listname = grep { !/^\./ && -f "$dir/$requirelevel/$_" && $_ =~ m/\.(sql|xml)$/ } readdir(MYDIR); > closedir MYDIR; > my %cell; > my @frameworklist; >@@ -453,12 +454,23 @@ sub load_sql { > local *STDERR; > open STDERR, ">>", \$dup_stderr; > >- eval { >- DBIx::RunSQL->run_sql_file( >- dbh => $dbh, >- sql => $filename, >- ); >- }; >+ if ( $filename =~ /xml$/ ) { >+ eval { >+ my $dom = XML::LibXML->load_xml( location => $filename ); # Load XML >+ my $table = $dom->documentElement->nodeName; # Find table name >+ my $query = "LOAD XML LOCAL INFILE '".$filename."' INTO TABLE ".$table; # MySQL only >+ my $loadxml = $dbh->prepare($query); >+ $loadxml->execute(); >+ }; >+ } >+ else { >+ eval { >+ DBIx::RunSQL->run_sql_file( >+ dbh => $dbh, >+ sql => $filename, >+ ); >+ }; >+ } > }; > # errors thrown while loading installer data should be logged > if( $dup_stderr ) { >-- >2.17.0
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 13897
:
37165
|
75930
|
75931
|
95884
|
96370
|
96397
|
96539
|
96591
|
96592
|
96754
|
96755
|
97068
|
97069
|
98507
|
98741
|
99392
|
99393
|
99394
|
99395
|
100340
|
100341
|
100342
|
100343