[otrs-cvs] otrs/Kernel/System/AuthSession DB.pm,1.71,1.72
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/System/AuthSession
In directory lancelot:/tmp/cvs-serv2213/Kernel/System/AuthSession
Modified Files:
DB.pm
Log Message:
Improved handling of session data in database.
Author: mh
Index: DB.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/AuthSession/DB.pm,v
retrieving revision 1.71
retrieving revision 1.72
diff -2 -u -d -r1.71 -r1.72
--- DB.pm 20 Nov 2012 15:42:41 -0000 1.71
+++ DB.pm 22 Nov 2012 09:19:35 -0000 1.72
@@ -313,4 +313,12 @@
return if !@SQLs;
+ # delete old session data with the same session id
+ $Self->{DBObject}->Do(
+ SQL => "
+ DELETE FROM $Self->{SessionTable}
+ WHERE session_id = ?",
+ Bind => [ \$SessionID, ],
+ );
+
# store session id and data
ROW:
@@ -495,17 +503,13 @@
my ( $Self, %Param ) = @_;
- return 1 if !$Self->{Cache};
+ return 1 if !$Self->{CacheUpdate};
SESSIONID:
- for my $SessionID ( sort keys %{ $Self->{Cache} } ) {
+ for my $SessionID ( sort keys %{ $Self->{CacheUpdate} } ) {
next SESSIONID if !$SessionID;
- my $Data = $Self->{Cache}->{$SessionID};
- my $UpdateMode = 0;
- if ( $Self->{CacheUpdate}->{$SessionID} ) {
- $Data = $Self->{CacheUpdate}->{$SessionID};
- $UpdateMode = 1;
- }
+ # extract session data to update
+ my $Data = $Self->{CacheUpdate}->{$SessionID};
next SESSIONID if !$Data;
@@ -539,31 +543,11 @@
}
- if ($UpdateMode) {
-
- KEY:
- for my $Key ( sort keys %{ $Self->{CacheUpdate}->{$SessionID} } ) {
-
- next KEY if !$Key;
-
- # extract database id
- my $ID = $Self->{CacheID}->{$SessionID}->{$Key} || 1;
+ KEY:
+ for my $Key ( sort keys %{ $Self->{CacheUpdate}->{$SessionID} } ) {
- # delete old session data from the database
- $Self->{DBObject}->Do(
- SQL => "
- DELETE FROM $Self->{SessionTable}
- WHERE session_id = ?
- AND data_key = ?
- AND id < ?",
- Bind => [ \$SessionID, \$Key, \$ID ],
- );
- }
- }
- else {
+ next KEY if !$Key;
- my $BiggestID = 0;
- if ( %{ $Self->{CacheID}->{$SessionID} } ) {
- $BiggestID = [ sort keys %{ $Self->{CacheID}->{$SessionID} } ]->[-1];
- }
+ # extract database id
+ my $ID = $Self->{CacheID}->{$SessionID}->{$Key} || 1;
# delete old session data from the database
@@ -572,6 +556,7 @@
DELETE FROM $Self->{SessionTable}
WHERE session_id = ?
+ AND data_key = ?
AND id <= ?",
- Bind => [ \$SessionID, \$BiggestID ],
+ Bind => [ \$SessionID, \$Key, \$ID ],
);
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log