Bug 42185: Remove C4::Context::_new_dbh
This looks trivial at first, but it's not, because of forking and the comment in C4::Context I don't think the comment makes sense, we need to retrieve a new dbh, and so passing the 'new' parameters to C4::Context->dbh should do the same. Test plan: Try rebuild_zebra.pl and confirm there is no error % perl misc/migration_tools/rebuild_zebra.pl --processes 2 -b Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Thomas Klausner <domm@plix.at> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
224ba4ab48
commit
d533f2bbff
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue