MediaWiki REL1_28
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.
 
 getSessionById ( $id, $create=false, WebRequest $request=null)
 Fetch a session by ID.
 
 getSessionForRequest (WebRequest $request)
 Fetch the session for a request (or a new empty session if none is attached to it)
 
 getVaryCookies ()
 Return the list of cookies that need varying on.
 
 getVaryHeaders ()
 Return the HTTP headers that need varying on.
 
 invalidateSessionsForUser (User $user)
 Invalidate sessions for a user.
 

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

\OverflowException 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.

◆ 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 );
}
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition hooks.txt:1096
$header
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: