ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.ilSessionDBHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
27 public function setSaveHandler(): bool
28 {
29 if (session_status() === PHP_SESSION_ACTIVE) {
30 return true;
31 }
32
33 return session_set_save_handler(
34 $this,
35 true // Registers session_write_close() as a register_shutdown_function() function.
36 );
37 }
38
45 public function open($path, $name): bool
46 {
47 return true;
48 }
49
55 public function close(): bool
56 {
57 return true;
58 }
59
66 public function read($id): string
67 {
68 return ilSession::getData($id);
69 }
70
76 public function write($id, $data): bool
77 {
78 chdir(IL_INITIAL_WD);
79
80 return ilSession::writeData($id, $data);
81 }
82
87 public function destroy($id): bool
88 {
89 return ilSession::destroy($id);
90 }
91
96 public function gc(int $max_lifetime): int | false
97 {
99 }
100
101 public function validateId(string $id): bool
102 {
103 return ilSession::exists($id);
104 }
105
111 public function updateTimestamp(string $id, string $data): bool
112 {
114 return true;
115 }
116
117 return $this->write($id, $data);
118 }
119}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setSaveHandler()
Registers the session save handler session.save_handler must be 'user'.
read($id)
Reads data of the session identified by $session_id and returns it as a serialised string.
updateTimestamp(string $id, string $data)
PHP calls this when $_SESSION did not change.
gc(int $max_lifetime)
Removes sessions that weren't updated for more than gc_maxlifetime seconds.
open($path, $name)
Opens session, normally a db connection would be opened here, but we use the standard ilias db connec...
write($id, $data)
Writes serialized session data to the database.
destroy($id)
Destroys session.
static updateTimestamp(string $session_id)
Move the idle deadline of an existing session without rewriting its payload.
static destroyExpiredSessions()
Destroy expired sessions.
static getData(string $a_session_id)
Get session data from table.
static destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
static exists(string $a_session_id)
$data
Definition: storeScorm.php:45