[Koha-patches] [PATCH] Bug 7857 - database upgrade fails with plack

Dobrica Pavlinusic dpavlin at rot13.org
Fri Mar 30 22:17:49 CEST 2012


Updating database structure

Update errors :

    Can't locate C4/Context.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 .) at /srv/koha/installer/data/mysql/updatedatabase.pl line 37.
    BEGIN failed--compilation aborted at /srv/koha/installer/data/mysql/updatedatabase.pl line 37.

It seems that plack cleans enviroment, so we have to re-instart PERL5LIB
so script invocation won't fail.
---
 installer/install.pl |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/installer/install.pl b/installer/install.pl
index 419273a..f62148f 100755
--- a/installer/install.pl
+++ b/installer/install.pl
@@ -312,6 +312,15 @@ elsif ( $step && $step == 3 ) {
         # Not 1st install, the only sub-step : update database
         #
         #Do updatedatabase And report
+
+	if ( ! defined $ENV{PERL5LIB} ) {
+		my $find = "C4/Context.pm";
+		my $path = $INC{$find};
+		$path =~ s/\Q$find\E//;
+		$ENV{PERL5LIB} = $path;
+		warn "# plack? inserted PERL5LIB $ENV{PERL5LIB}\n";
+	}
+
         my $cmd = C4::Context->config("intranetdir") . "/installer/data/$info{dbms}/updatedatabase.pl";
         my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = IPC::Cmd::run(command => $cmd, verbose => 0);
 
-- 
1.7.2.5



More information about the Koha-patches mailing list