From ac8c0a8a4a0c1050ea23b283ebdd9d616bc187ef Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 15 Feb 2024 14:05:21 +0100 Subject: [PATCH] Bug 36098: Allow to pass storage_method Will need this on follow-up bugs. Signed-off-by: Jonathan Druart (cherry picked from commit 56d8ac247698f8755a8215245dffd000877d76e7) Signed-off-by: Fridolin Somers (cherry picked from commit be03ca910f714e8991ff8e2e0163f3c0f9de2b08) Signed-off-by: Lucas Gass --- Koha/Session.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Koha/Session.pm b/Koha/Session.pm index 8f74ee10ca..54290d3df3 100644 --- a/Koha/Session.pm +++ b/Koha/Session.pm @@ -51,8 +51,8 @@ will be created. =cut sub _get_session_params { - my $class = shift; - my $storage_method = C4::Context->preference('SessionStorage'); + my ( $class, $storage_method ) = @_; + $storage_method ||= C4::Context->preference('SessionStorage'); if ( $storage_method eq 'mysql' ) { my $dbh = C4::Context->dbh; return { dsn => "serializer:yamlxs;driver:MySQL;id:md5", dsn_args => { Handle => $dbh } }; @@ -75,8 +75,9 @@ sub _get_session_params { sub get_session { my ( $class, $args ) = @_; - my $sessionID = $args->{sessionID}; - my $params = $class->_get_session_params(); + my $sessionID = $args->{sessionID}; + my $storage_method = $args->{storage_method}; + my $params = $class->_get_session_params( { storage_method => $storage_method } ); my $session; if ($sessionID) { # find existing CGI::Session::ErrorHandler->set_error(q{}); # clear error, cpan issue #111463 -- 2.39.5