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

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

Return to bug 17427