View | Details | Raw Unified | Return to bug 17427
Collapse All | Expand All

(-)a/C4/Auth.pm (-5 / +5 lines)
Lines 1834-1848 will be created. Link Here
1834
1834
1835
sub _get_session_params {
1835
sub _get_session_params {
1836
    my $storage_method = C4::Context->preference('SessionStorage');
1836
    my $storage_method = C4::Context->preference('SessionStorage');
1837
    my $serializer = q{serialize:JSON};
1837
    if ( $storage_method eq 'mysql' ) {
1838
    if ( $storage_method eq 'mysql' ) {
1838
        my $dbh = C4::Context->dbh;
1839
        my $dbh = C4::Context->dbh;
1839
        # Note that the doc is wrong, type is required, if not provided it default to File
1840
        # Note that the doc is wrong, type is required, if not provided it default to File
1840
        return { dbh => $dbh, type => 'serialize:yamlxs;driver:mysql;id:MD5' };
1841
        return { dbh => $dbh, type => "driver:mysql;$serializer;id:MD5" };
1841
    } elsif ( $storage_method eq 'Pg' ) {
1842
    } elsif ( $storage_method eq 'Pg' ) {
1842
        die "The system preference SessionStorage is set to 'Pg' but this is not supported yet!";
1843
        die "The system preference SessionStorage is set to 'Pg' but this is not supported yet!";
1843
    } elsif ( $storage_method eq 'memcached' and my $memcached = Koha::Caches->get_instance->memcached_cache ) {
1844
    } elsif ( $storage_method eq 'memcached' and my $memcached = Koha::Caches->get_instance->memcached_cache ) {
1844
        return {
1845
        return {
1845
            type  => 'serialize:yamlxs;driver:Memcached;id:SHA1',
1846
            type  => "driver:Memcached;id:SHA1;$serializer",
1846
            cache => $memcached,
1847
            cache => $memcached,
1847
        };
1848
        };
1848
    } elsif ( $storage_method ne 'tmp' ) {
1849
    } elsif ( $storage_method ne 'tmp' ) {
Lines 1855-1868 sub _get_session_params { Link Here
1855
        }
1856
        }
1856
        my $dir = C4::Context::temporary_directory;
1857
        my $dir = C4::Context::temporary_directory;
1857
        my $instance = C4::Context->config('database');    #actually for packages not exactly the instance name, but generally safer to leave it as it is
1858
        my $instance = C4::Context->config('database');    #actually for packages not exactly the instance name, but generally safer to leave it as it is
1858
        return { type => 'serialize:yamlxs;driver:File;id:MD5', directory => "$dir/cgisess_$instance" };
1859
        return { type => "driver:File;$serializer;id:MD5", directory => "$dir/cgisess_$instance" };
1859
    }
1860
    }
1860
}
1861
}
1861
1862
1862
sub get_session {
1863
sub get_session {
1863
    my $sessionID      = shift;
1864
    my $sessionID      = shift;
1864
    my $params = _get_session_params();
1865
    my $params = _get_session_params();
1865
    my $session = Data::Session->new( %$params ) || die $Data::Session::errstr;
1866
    my $session = Data::Session->new( %$params, id => $sessionID ) || die $Data::Session::errstr;
1866
    return $session;
1867
    return $session;
1867
}
1868
}
1868
1869
1869
- 

Return to bug 17427