From 2ecce44ce3c7488998dff5327c0aa8496a0e9b65 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Dec 2010 15:24:40 +0100 Subject: [PATCH] Speichern des Session-Inhaltes in eigene Funktion ausgelagert --- SL/Auth.pm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/SL/Auth.pm b/SL/Auth.pm index 9b465ce65..7c9790462 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -604,17 +604,27 @@ sub create_or_refresh_session { } - $query = qq|INSERT INTO auth.session_content (session_id, sess_key, sess_value) VALUES (?, ?, ?)|; - $sth = prepare_query($form, $dbh, $query); + $self->save_session($dbh); + + $dbh->commit(); + + $main::lxdebug->leave_sub(); +} + +sub save_session { + my $self = shift; + my $provided_dbh = shift; + + my $dbh = $provided_dbh || $self->dbconnect(); + + my $query = qq|INSERT INTO auth.session_content (session_id, sess_key, sess_value) VALUES (?, ?, ?)|; + my $sth = prepare_query($::form, $dbh, $query); foreach my $key (sort keys %{ $self->{SESSION} }) { - do_statement($form, $sth, $query, $session_id, $key, $self->{SESSION}->{$key}); + do_statement($::form, $sth, $query, $session_id, $key, $self->{SESSION}->{$key}); } $sth->finish(); - $dbh->commit(); - - $main::lxdebug->leave_sub(); } sub set_session_value { -- 2.20.1