[Koha-devel] Question about Koha Session

dcook at prosentient.com.au dcook at prosentient.com.au
Wed Jun 2 05:56:55 CEST 2021


Glancing at https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27113, I don’t know why a person would need to use a session object. Happy for that to be explained. (Technically, it doesn’t look like it’s actually doing anything useful with CGI::Session, since it looks like it’s just throwing data into a file-backed session, and not even using it.)

 

As for sessions more generally, Koha does not handle sessions very well. It’s a goal of mine to create a Koha::Session class at some point, but there are only so many hours in the day.

 

When I work with sessions, I use C4::Auth::get_session($sessionID) where $sessionID is the value of the CGISESSID cookie. You will always have a CGISESSID *except* when you land on Koha for the very first time. But then when you’re on the landing page, you have access to the new session object directly anyway. 

 

I think Ivan might be on the wrong path here. Happy to discuss it further though. 

 

David Cook

Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: Koha-devel <koha-devel-bounces at lists.koha-community.org> On Behalf Of Philippe Blouin
Sent: Wednesday, 2 June 2021 1:53 AM
To: Ivan Dziuba <ivan.dziuba at inlibro.com>; koha-devel at lists.koha-community.org
Subject: Re: [Koha-devel] Question about Koha Session

 

Hello Koha,

Actually, I'll extend Ivan's question a bit: is CGI::Session->load() the way to go, or C4::Auth::get_session() would do the same thing ?

Thnaks

Philippe Blouin,
Directeur de la technologie

Tél.  : (833) 465-4276, poste 230
 <mailto:philippe.blouin at inLibro.com> philippe.blouin at inLibro.com 

inLibro | pour esprit libre |  <http://www.inLibro.com> www.inLibro.com 

On 2021-06-01 11:30 a.m., Ivan Dziuba wrote:

Hello!

 

I develop one patch of Koha for Autocomplete - https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27113

In this patch I use a session. I don't want to create every time new session and I have changed CGI::Session->new() from CGI::Session->load().

But I don't sure in this condition 'CGI::Session->load() or die CGI::Session->errstr();'

 

Can I use (DIE) in this condition or not?

 

Thanks!





_______________________________________________
Koha-devel mailing list
Koha-devel at lists.koha-community.org <mailto:Koha-devel at lists.koha-community.org> 
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210602/65fdf864/attachment.htm>


More information about the Koha-devel mailing list