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

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

Return to bug 17427