LockLessSessionsMySQL

From Request Tracker Wiki
Jump to navigation Jump to search

If you want RT to use Apache::Session::MySQL on no-locking mode, you will have to do the followings changes on your RT:

  • Create a file called LockLessMySQL.pm in /path/to/your/rt/local/lib/Apache/Session, if Session folder doesn't exists, first create it (mkdir -p /path/to/your/rt/local/lib/Apache/Session)
  • Add the below content on that file:
package Apache::Session::LockLessMySQL;

use strict;
use warnings;

our $VERSION = '0.01';

use base qw(Apache::Session);

use Apache::Session;
use Apache::Session::Lock::Null;
use Apache::Session::Store::MySQL;
use Apache::Session::Generate::MD5;
use Apache::Session::Serialize::Storable;

sub populate {
   my $self = shift;

   $self->{object_store} = new Apache::Session::Store::MySQL $self;
   $self->{lock_manager} = new Apache::Session::Lock::Null $self;
   $self->{generate}     = \&Apache::Session::Generate::MD5::generate;
   $self->{validate}     = \&Apache::Session::Generate::MD5::validate;
   $self->{serialize}    = \&Apache::Session::Serialize::Storable::serialize;
   $self->{unserialize}  = \&Apache::Session::Serialize::Storable::unserialize;

   return $self;
}

1;
  • If you are in RT > 3.7
    • Edit /path/to/your/rt/lib/RT/Interface/Web/Session.pm and replace "Apache::Session::MySQL" (line 100) with "Apache::Session::LockLessMySQL"
  • Restart your web server

Thanks Rus for the hand :-)