1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
<?php
/**
* MediaWiki\Session entry point interface
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Session
*/
namespace MediaWiki\Session;
use MediaWiki\Request\WebRequest;
use MediaWiki\User\User;
use Psr\Log\LoggerAwareInterface;
/**
* This exists to make IDEs happy, so they don't see the
* internal-but-required-to-be-public methods on SessionManager.
*
* @ingroup Session
* @since 1.27
*/
interface SessionManagerInterface extends LoggerAwareInterface {
/**
* 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().
* @param WebRequest $request Any existing associated session will be reset
* to the session corresponding to the data in the request itself.
* @return Session
* @throws \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.
*/
public function getSessionForRequest( WebRequest $request );
/**
* Fetch a session by ID
*
* @param string $id
* @param bool $create If 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.
* @param WebRequest|null $request Corresponding request. Any existing
* session associated with this WebRequest object will be overwritten.
* @return Session|null
*/
public function getSessionById( $id, $create = false, ?WebRequest $request = null );
/**
* Create a new, empty session
*
* The first provider configured that is able to provide an empty session
* will be used.
*
* @param WebRequest|null $request Corresponding request. Any existing
* session associated with this WebRequest object will be overwritten.
* @return Session
*/
public function getEmptySession( ?WebRequest $request = null );
/**
* 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.
*
* @param User $user
*/
public function invalidateSessionsForUser( User $user );
/**
* Return the HTTP headers that need varying on.
*
* The return value is such that someone could theoretically do this:
* @code
* foreach ( $provider->getVaryHeaders() as $header => $_ ) {
* $outputPage->addVaryHeader( $header );
* }
* @endcode
*
* @return array<string,null>
*/
public function getVaryHeaders();
/**
* Return the list of cookies that need varying on.
* @return string[]
*/
public function getVaryCookies();
}
|