This is an old revision of the document!
Internals: SympaSession.pm
This module provides objects to create, load, store and remove sessions
new()
Creates an object Session.
Parameters
- robot : sessions are related to a specific robot
- cookie : the sympa_session cookie value which is a random value without any semantic
If cookie is undef or not in session_table, new() will create a new session by allocation of a random. If cookie is defined and found in the sympa_session table new check if the session is valid (mainly : the http client host (remote_addr) must be the same as the host that initialyse the session). : may be usefull to ignore old sessions. If the session is valid it is loaded : load() .
load()
- load() read session attributes from session_table using cookie value as the primary key. All attributes are returned in a hash. Load() use tools::string_2_hash in order to convert the varchar data_session column in a set of vars <var>=“<value>”;<var>=“<value>”;
store()
- store() store session attributes from curernt objet into session_table. Store update the date_session attributes which is used by &SympaSession::purge_session() to remove old sessions.
store() convert a set of vars into a data_session string which can be stored in the database using tools::hash_2_string
purge_old_sessions()
Parameters
- robot
This proc is not object oriented. It is deseign to remove from session_table old session. It is controled by the task_manager depending on sympa.conf parameter session_expiration_period
list_sessions()
Use to list current session (feature from sympa admin page/listmaster only)
Parameters
delay : number of second to select the age of listed sessions robot : connected_only : off|on in order to limit or not teh listed sessions to connected users
return an array of hash that describe sessions