MediaWiki  1.33.0
MediaWiki\Session\SessionManagerInterface Interface Reference

This exists to make IDEs happy, so they don't see the internal-but-required-to-be-public methods on SessionManager. More...

Inheritance diagram for MediaWiki\Session\SessionManagerInterface:
Collaboration diagram for MediaWiki\Session\SessionManagerInterface:

Public Member Functions

 getEmptySession (WebRequest $request=null)
 Create a new, empty session. More...
 
 getSessionById ( $id, $create=false, WebRequest $request=null)
 Fetch a session by ID. More...
 
 getSessionForRequest (WebRequest $request)
 Fetch the session for a request (or a new empty session if none is attached to it) More...
 
 getVaryCookies ()
 Return the list of cookies that need varying on. More...
 
 getVaryHeaders ()
 Return the HTTP headers that need varying on. More...
 
 invalidateSessionsForUser (User $user)
 Invalidate sessions for a user. More...
 

Detailed Description

This exists to make IDEs happy, so they don't see the internal-but-required-to-be-public methods on SessionManager.

Since
1.27

Definition at line 37 of file SessionManagerInterface.php.

Member Function Documentation

◆ getEmptySession()

MediaWiki\Session\SessionManagerInterface::getEmptySession ( WebRequest  $request = null)

Create a new, empty session.

The first provider configured that is able to provide an empty session will be used.

Parameters
WebRequest | null$requestCorresponding request. Any existing session associated with this WebRequest object will be overwritten.
Returns
Session

Implemented in MediaWiki\Session\SessionManager.

◆ getSessionById()

MediaWiki\Session\SessionManagerInterface::getSessionById (   $id,
  $create = false,
WebRequest  $request = null 
)

Fetch a session by ID.

Parameters
string$id
bool$createIf no session exists for $id, try to create a new one. May still return null if a session for $id exists but cannot be loaded.
WebRequest | null$requestCorresponding request. Any existing session associated with this WebRequest object will be overwritten.
Returns
Session|null

Implemented in MediaWiki\Session\SessionManager.

◆ getSessionForRequest()

MediaWiki\Session\SessionManagerInterface::getSessionForRequest ( WebRequest  $request)

Fetch the session for a request (or a new empty session if none is attached to it)

Note
You probably want to use $request->getSession() instead. It's more efficient and doesn't break FauxRequests or sessions that were changed by $this->getSessionById() or $this->getEmptySession().
Parameters
WebRequest$requestAny existing associated session will be reset to the session corresponding to the data in the request itself.
Returns
Session
Exceptions

Implemented in MediaWiki\Session\SessionManager.

◆ getVaryCookies()

MediaWiki\Session\SessionManagerInterface::getVaryCookies ( )

Return the list of cookies that need varying on.

Returns
string[]

Implemented in MediaWiki\Session\SessionManager.

◆ getVaryHeaders()

MediaWiki\Session\SessionManagerInterface::getVaryHeaders ( )

Return the HTTP headers that need varying on.

The return value is such that someone could theoretically do this:

foreach ( $provider->getVaryHeaders() as $header => $options ) {
$outputPage->addVaryHeader( $header, $options );
}
Returns
array

Implemented in MediaWiki\Session\SessionManager.

◆ invalidateSessionsForUser()

MediaWiki\Session\SessionManagerInterface::invalidateSessionsForUser ( User  $user)

Invalidate sessions for a user.

After calling this, existing sessions should be invalid. For mutable session providers, this generally means the user has to log in again; for immutable providers, it generally means the loss of session data.

Parameters
User$user

Implemented in MediaWiki\Session\SessionManager.


The documentation for this interface was generated from the following file:
$header
$header
Definition: updateCredits.php:41
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1985
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9