[Rt-commit] rt branch, 4.2/session-properties, created. rt-4.0.0rc6-156-g92427d6

Ruslan Zakirov ruz at bestpractical.com
Wed Mar 9 04:39:11 EST 2011


The branch, 4.2/session-properties has been created
        at  92427d64eff0e16e0718e7e00cc22bc80df33668 (commit)

- Log -----------------------------------------------------------------
commit 92427d64eff0e16e0718e7e00cc22bc80df33668
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 9 12:36:32 2011 +0300

    %WebSessionProperties option - more backends can be used

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index fc755c9..fbb68e6 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1276,14 +1276,26 @@ Set($AutoCreate, undef);
 =item C<$WebSessionClass>
 
 C<$WebSessionClass> is the class you wish to use for managing Sessions.
-It defaults to use your SQL database, but if you are using MySQL 3.x and
-plans to use non-ascii Queue names, uncomment and add this line to
-F<RT_SiteConfig.pm> will prevent session corruption.
+On mysql and Pg it defaults to use your database, in other cases
+sessions are stored in files using L<Apache::Session::File>. Other
+installed Apache:Session::* modules can be used to store sessions.
 
 =cut
 
+Set($WebSessionClass, undef);
 # Set($WebSessionClass , 'Apache::Session::File');
 
+=item C<%WebSessionProperties>
+
+C<%WebSessionProperties> is the hash to configure class L</$WebSessionClass>
+in case custom class is used. By default it's empty and values are picked
+depending on the class. Make sure that it's empty if you're using DB as session
+backend.
+
+=cut
+
+Set( %WebSessionProperties );
+
 =item C<$AutoLogoff>
 
 By default, RT's user sessions persist until a user closes his or her 
diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
index 0cce092..7d0495b 100644
--- a/lib/RT/Interface/Web/Session.pm
+++ b/lib/RT/Interface/Web/Session.pm
@@ -112,15 +112,25 @@ new session objects.
 
 sub Attributes {
     my $class = $_[0]->Class;
-    return !$class->isa('Apache::Session::File') ? {
-            Handle      => $RT::Handle->dbh,
-            LockHandle  => $RT::Handle->dbh,
-            Transaction => 1,
-        } : {
+    my $res;
+    if ( my %props = RT->Config->Get('WebSessionProperties') ) {
+        $res = \%props;
+    }
+    elsif ( $class->isa('Apache::Session::File') ) {
+        $res = {
             Directory     => $RT::MasonSessionDir,
             LockDirectory => $RT::MasonSessionDir,
             Transaction   => 1,
         };
+    }
+    else {
+        $res = {
+            Handle      => $RT::Handle->dbh,
+            LockHandle  => $RT::Handle->dbh,
+            Transaction => 1,
+        };
+    }
+    return $res;
 }
 
 =head3 Ids

-----------------------------------------------------------------------


More information about the Rt-commit mailing list