From bfff1494eff161711c9328e416b83d0abf3a6c37 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 23 Nov 2016 13:12:09 +0000 Subject: [PATCH] Bug 17666 - .perl atomic update does not work under kohadevbox --- installer/data/mysql/updatedatabase.pl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9b77f8d..049f96f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -47,7 +47,6 @@ use MARC::File::XML ( BinaryEncoding => 'utf8' ); use File::Path qw[remove_tree]; # perl core module use File::Spec; -use Path::Tiny; # FIXME - The user might be installing a new database, so can't rely # on /etc/koha.conf anyway. @@ -13707,7 +13706,7 @@ foreach my $file ( sort readdir $dirh ) { my $installer = C4::Installer->new(); my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1; } elsif ( $file =~ /\.perl$/ ) { - my $code = path( $update_dir . $file )->slurp_utf8; + my $code = slurp_file( $update_dir . $file ); eval $code; say "Atomic update generated errors: $@" if $@; } @@ -13715,6 +13714,20 @@ foreach my $file ( sort readdir $dirh ) { =head1 FUNCTIONS +=head2 slurp_file + +=cut + +sub slurp_file { + my ($file) = @_; + local $/ = undef; + open( FILE, '<:encoding(UTF-8)', $file ) or die "Couldn't open file: $!"; + binmode FILE; + my $string = ; + close FILE; + return $string; +} + =head2 TableExists($table) =cut -- 2.1.4