From 6844d581bac018c7892e6b1c458a981b5e3ff313 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 15 Jul 2013 12:32:07 +0200 Subject: [PATCH] =?utf8?q?DBUpgrade2:=20verhindern,=20dass=20$::form->get?= =?utf8?q?=5Fstandard=5Fdbh=20eine=20zweite=20Verbindung=20=C3=B6ffnet?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ansonsten sind Deadlocks absolut möglich. --- SL/DBUpgrade2.pm | 3 +++ SL/Form.pm | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index eba336fe2..3cdb9a44b 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -243,6 +243,7 @@ sub process_perl_script { $dbh->begin_work; # setup dbup_ export vars & run script + my $old_dbh = $::form->set_standard_dbh($dbh); my %dbup_myconfig = map { ($_ => $::form->{$_}) } qw(dbname dbuser dbpasswd dbhost dbport dbconnect); my $result = eval { SL::DBUpgrade2::Base::execute_script( @@ -255,6 +256,8 @@ sub process_perl_script { my $error = $EVAL_ERROR; + $::form->set_standard_dbh($old_dbh); + $dbh->rollback if 1 != ($result // -1); return $error if $self->{return_on_error} && (1 != ($result // -1)); diff --git a/SL/Form.pm b/SL/Form.pm index 79ff7034f..b18bc67b5 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1403,6 +1403,14 @@ sub get_standard_dbh { return $standard_dbh; } +sub set_standard_dbh { + my ($self, $dbh) = @_; + my $old_dbh = $standard_dbh; + $standard_dbh = $dbh; + + return $old_dbh; +} + sub date_closed { $main::lxdebug->enter_sub(); -- 2.39.5