ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionDBHandler Class Reference

Database Session Handling. More...

+ Inheritance diagram for ilSessionDBHandler:
+ Collaboration diagram for ilSessionDBHandler:

Public Member Functions

 setSaveHandler ()
 Registers the session save handler session.save_handler must be 'user'. More...
 
 open ($path, $name)
 Opens session, normally a db connection would be opened here, but we use the standard ilias db connection, so nothing must be done here. More...
 
 close ()
 close session More...
 
 read ($id)
 Reads data of the session identified by $session_id and returns it as a serialised string. More...
 
 write ($id, $data)
 Writes serialized session data to the database. More...
 
 destroy ($id)
 Destroys session. More...
 
 gc ($max_lifetime)
 Removes sessions that weren't updated for more than gc_maxlifetime seconds. More...
 

Detailed Description

Database Session Handling.

Definition at line 24 of file class.ilSessionDBHandler.php.

Member Function Documentation

◆ close()

ilSessionDBHandler::close ( )

close session

for a db nothing has to be done here

Definition at line 58 of file class.ilSessionDBHandler.php.

58  : bool
59  {
60  return true;
61  }

◆ destroy()

ilSessionDBHandler::destroy (   $id)

Destroys session.

Parameters
string$idsession id

Definition at line 90 of file class.ilSessionDBHandler.php.

References $id, and ilSession\_destroy().

90  : bool
91  {
92  return ilSession::_destroy($id);
93  }
static _destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ gc()

ilSessionDBHandler::gc (   $max_lifetime)

Removes sessions that weren't updated for more than gc_maxlifetime seconds.

Parameters
int$max_lifetimeSessions that have not updated for the last max_lifetime seconds will be removed.

Definition at line 99 of file class.ilSessionDBHandler.php.

References ilSession\_destroyExpiredSessions().

100  {
102  }
static _destroyExpiredSessions()
Destroy expired sessions.
+ Here is the call graph for this function:

◆ open()

ilSessionDBHandler::open (   $path,
  $name 
)

Opens session, normally a db connection would be opened here, but we use the standard ilias db connection, so nothing must be done here.

Parameters
string$path
string$namesession name [PHPSESSID]

Definition at line 48 of file class.ilSessionDBHandler.php.

48  : bool
49  {
50  return true;
51  }

◆ read()

ilSessionDBHandler::read (   $id)

Reads data of the session identified by $session_id and returns it as a serialised string.

If there is no session with this ID an empty string is returned

Parameters
string$id

Definition at line 69 of file class.ilSessionDBHandler.php.

References $id, and ilSession\_getData().

69  : string
70  {
71  return ilSession::_getData($id);
72  }
static _getData(string $a_session_id)
Get session data from table.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setSaveHandler()

ilSessionDBHandler::setSaveHandler ( )

Registers the session save handler session.save_handler must be 'user'.

Definition at line 30 of file class.ilSessionDBHandler.php.

30  : bool
31  {
32  if (session_status() === PHP_SESSION_ACTIVE) {
33  return true;
34  }
35 
36  return session_set_save_handler(
37  $this,
38  true // Registers session_write_close() as a register_shutdown_function() function.
39  );
40  }

◆ write()

ilSessionDBHandler::write (   $id,
  $data 
)

Writes serialized session data to the database.

Parameters
string$idsession id
string$datasession data

Definition at line 79 of file class.ilSessionDBHandler.php.

References $data, and $id.

79  : bool
80  {
81  chdir(IL_INITIAL_WD);
82 
83  return ilSession::_writeData($id, $data);
84  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

The documentation for this class was generated from the following file: