MediaWiki master
MediaWiki\Session\PHPSessionHandler Class Reference

Adapter for PHP's session handling. More...

Inherits SessionHandlerInterface.

Collaboration diagram for MediaWiki\Session\PHPSessionHandler:

Public Member Functions

 close ()
 Close the session (handler)
 
 destroy ( $id)
 Destroy a session.
 
 gc ( $maxlifetime)
 Execute garbage collection.
 
 open ( $save_path, $session_name)
 Initialize the session (handler)
 
 read ( $id)
 Read session data.
 
 setManager (SessionManagerInterface $manager, LoggerInterface $logger)
 
 write ( $id, $dataStr)
 Write session data.
 

Static Public Member Functions

static install (SessionManagerInterface $manager)
 Install a session handler for the current web request.
 
static isEnabled ()
 Test whether the handler is installed and enabled.
 
static isInstalled ()
 Test whether the handler is installed.
 

Protected Member Functions

 __construct (SessionManagerInterface $manager)
 

Protected Attributes

bool $enable = false
 Whether PHP session handling is enabled.
 
LoggerInterface $logger
 
SessionManagerInterface $manager = null
 
array $sessionFieldCache = []
 Track original session fields for later modification check.
 
bool $warn = true
 

Static Protected Attributes

static PHPSessionHandler $instance = null
 

Detailed Description

Adapter for PHP's session handling.

Since
1.27
Deprecated
since 1.45 Integration with PHP session handling will be removed in the future

Definition at line 23 of file PHPSessionHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Session\PHPSessionHandler::__construct ( SessionManagerInterface $manager)
protected

Member Function Documentation

◆ close()

MediaWiki\Session\PHPSessionHandler::close ( )

Close the session (handler)

Access: internal
For internal use only
Returns
true

Definition at line 190 of file PHPSessionHandler.php.

◆ destroy()

MediaWiki\Session\PHPSessionHandler::destroy ( $id)

Destroy a session.

Access: internal
For internal use only
Parameters
string$idSession id
Returns
true

Definition at line 373 of file PHPSessionHandler.php.

◆ gc()

MediaWiki\Session\PHPSessionHandler::gc ( $maxlifetime)

Execute garbage collection.

Access: internal
For internal use only
Parameters
int$maxlifetimeMaximum session life time (ignored)
Returns
true

Definition at line 395 of file PHPSessionHandler.php.

◆ install()

static MediaWiki\Session\PHPSessionHandler::install ( SessionManagerInterface $manager)
static

Install a session handler for the current web request.

Definition at line 94 of file PHPSessionHandler.php.

References MediaWiki\Session\PHPSessionHandler\$manager.

◆ isEnabled()

static MediaWiki\Session\PHPSessionHandler::isEnabled ( )
static

Test whether the handler is installed and enabled.

Returns
bool

Definition at line 87 of file PHPSessionHandler.php.

Referenced by MediaWiki\Session\SessionBackend\resetId(), and MediaWiki\Session\SessionBackend\unpersist().

◆ isInstalled()

static MediaWiki\Session\PHPSessionHandler::isInstalled ( )
static

Test whether the handler is installed.

Returns
bool

Definition at line 79 of file PHPSessionHandler.php.

References MediaWiki\Session\PHPSessionHandler\$instance.

◆ open()

MediaWiki\Session\PHPSessionHandler::open ( $save_path,
$session_name )

Initialize the session (handler)

Access: internal
For internal use only
Parameters
string$save_pathPath used to store session files (ignored)
string$session_nameSession name (ignored)
Returns
true

Definition at line 174 of file PHPSessionHandler.php.

◆ read()

MediaWiki\Session\PHPSessionHandler::read ( $id)

Read session data.

Access: internal
For internal use only
Parameters
string$idSession id
Returns
string Session data

Definition at line 205 of file PHPSessionHandler.php.

◆ setManager()

MediaWiki\Session\PHPSessionHandler::setManager ( SessionManagerInterface $manager,
LoggerInterface $logger )
Access: internal
Use self::install().
Parameters
SessionManagerInterface$manager
LoggerInterface$logger

Definition at line 152 of file PHPSessionHandler.php.

Referenced by MediaWiki\Session\SessionManager\setupPHPSessionHandler().

◆ write()

MediaWiki\Session\PHPSessionHandler::write ( $id,
$dataStr )

Write session data.

Access: internal
For internal use only
Parameters
string$idSession id
string$dataStrSession data. Not that you should ever call this directly, but note that this has the same issues with code injection via user-controlled data as does PHP's unserialize function.
Returns
bool

Definition at line 254 of file PHPSessionHandler.php.

References wfDeprecated().

Member Data Documentation

◆ $enable

bool MediaWiki\Session\PHPSessionHandler::$enable = false
protected

Whether PHP session handling is enabled.

Definition at line 28 of file PHPSessionHandler.php.

◆ $instance

PHPSessionHandler MediaWiki\Session\PHPSessionHandler::$instance = null
staticprotected

◆ $logger

LoggerInterface MediaWiki\Session\PHPSessionHandler::$logger
protected

Definition at line 34 of file PHPSessionHandler.php.

◆ $manager

SessionManagerInterface MediaWiki\Session\PHPSessionHandler::$manager = null
protected

◆ $sessionFieldCache

array MediaWiki\Session\PHPSessionHandler::$sessionFieldCache = []
protected

Track original session fields for later modification check.

Definition at line 37 of file PHPSessionHandler.php.

◆ $warn

bool MediaWiki\Session\PHPSessionHandler::$warn = true
protected

Definition at line 31 of file PHPSessionHandler.php.


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