diff --git a/C4/Context.pm b/C4/Context.pm index 9e48a499b9..25c8832d55 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -613,15 +613,6 @@ sub _new_Zconn { return $Zconn; } -# _new_dbh -# Internal helper function (not a method!). This creates a new -# database connection from the data given in the current context, and -# returns it. -sub _new_dbh { - - Koha::Database->schema( { new => 1 } )->storage->dbh; -} - =head2 dbh $dbh = C4::Context->dbh; diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index a4a9410ee5..2603f4820f 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -524,7 +524,7 @@ sub select_all_authorities { $strsth .= qq{ LIMIT $offset,$length } if ( $length && $offset ); # If we are forking, we use a new db handle to prevent a potential deadlock - my $sth = $forks ? C4::Context::_new_dbh->prepare($strsth) : $dbh->prepare($strsth); + my $sth = $forks ? C4::Context->dbh( { new => 1 } )->prepare($strsth) : $dbh->prepare($strsth); $sth->execute(); return $sth; } @@ -538,7 +538,7 @@ sub select_all_biblios { $strsth .= qq{ LIMIT $offset,$length } if ($offset); # If we are forking, we use a new db handle to prevent a potential deadlock - my $sth = $forks ? C4::Context::_new_dbh->prepare($strsth) : $dbh->prepare($strsth); + my $sth = $forks ? C4::Context->dbh( { new => 1 } )->prepare($strsth) : $dbh->prepare($strsth); $sth->execute(); return $sth; }