MediaWiki  1.27.2
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)
 Fetch 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. 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

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

Fetch 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.

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.

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

Fetch the session for a request.

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
if there are multiple sessions tied for top priority in the request. Exception has a property "sessionInfos" holding the SessionInfo objects for the sessions involved.

Implemented in MediaWiki\Session\SessionManager.

MediaWiki\Session\SessionManagerInterface::getVaryCookies ( )

Return the list of cookies that need varying on.

Returns
string[]

Implemented in MediaWiki\Session\SessionManager.

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.

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: