Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Session handler base.

Copyright: 2013 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 117 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

handler:: (5 methods):
  start()
  write_close()
  abort()
  set_requires_write_lock()
  requires_write_lock()


Class: handler  - X-Ref

Session handler base.

start()   X-Ref
Start the session.

return: bool success

write_close()   X-Ref
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.


abort()   X-Ref
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.


set_requires_write_lock($requireswritelock)   X-Ref
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.

param: bool $requireswritelock true if needs to be open for writing

requires_write_lock()   X-Ref
Has this session been opened with a writelock? Your handler should call this during
start() if you support read-only sessions.

return: bool true if session is intended to have a write lock.