|
Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Session handler base. More...
Public Member Functions | |
| abort () | |
| Release lock on the session without writing it. More... | |
| init () | |
| Init session handler. More... | |
| kill_all_sessions () | |
| Kill all active sessions, the core sessions table is purged afterwards. More... | |
| kill_session ($sid) | |
| Kill one session, the session record is removed afterwards. More... | |
| requires_write_lock () | |
| Has this session been opened with a writelock? Your handler should call this during start() if you support read-only sessions. More... | |
| session_exists ($sid) | |
| Check the backend contains data for this session id. More... | |
| set_requires_write_lock ($requireswritelock) | |
| This is called after init() and before start() to indicate whether the session opened should be writable or not. More... | |
| start () | |
| Start the session. More... | |
| write_close () | |
| Write the session and release lock. More... | |
Protected Attributes | |
| boolean | $requireswritelock = false |
| $requireswritelock does the session need and/or have a lock? | |
Session handler base.
| core\session\handler::abort | ( | ) |
Release lock on the session without writing it.
May not be possible in older versions of PHP. If so, session may be written anyway so that any locks are released.
|
abstract |
Init session handler.
Reimplemented in core\session\database, core\session\file, core\session\memcached, and core\session\redis.
|
abstract |
Kill all active sessions, the core sessions table is purged afterwards.
Reimplemented in core\session\database, core\session\file, core\session\memcached, and core\session\redis.
|
abstract |
Kill one session, the session record is removed afterwards.
| string | $sid |
Reimplemented in core\session\database, core\session\file, core\session\memcached, and core\session\redis.
| core\session\handler::requires_write_lock | ( | ) |
Has this session been opened with a writelock? Your handler should call this during start() if you support read-only sessions.
| bool | true if session is intended to have a write lock. |
|
abstract |
Check the backend contains data for this session id.
Note: this is intended to be called from manager::session_exists() only.
| string | $sid |
| bool | true if session found. |
Reimplemented in core\session\database, core\session\file, core\session\memcached, and core\session\redis.
| core\session\handler::set_requires_write_lock | ( | $requireswritelock | ) |
This is called after init() and before start() to indicate whether the session opened should be writable or not.
This is intentionally captured even if your handler doesn't support non-locking sessions, so that behavior (upon session close) matches closely between handlers.
| bool | $requireswritelock | true if needs to be open for writing |
| core\session\handler::start | ( | ) |
Start the session.
| bool | success |
Reimplemented in core\session\memcached, and core\session\redis.
| core\session\handler::write_close | ( | ) |
Write the session and release lock.
If the session was not intentionally opened with a write lock, then we will abort the session instead if able.