Bug 36098: Allow to pass storage_method

Will need this on follow-up bugs.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2024-02-15 14:05:21 +01:00
parent 09de3f820b
commit 56d8ac2476
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
1 changed files with 5 additions and 4 deletions

View File

@ -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