3 * MediaWiki\Session entry point interface
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 namespace MediaWiki\Session
;
26 use Psr\Log\LoggerAwareInterface
;
30 * This exists to make IDEs happy, so they don't see the
31 * internal-but-required-to-be-public methods on SessionManager.
36 interface SessionManagerInterface
extends LoggerAwareInterface
{
38 * Fetch the persisted session ID in a request.
40 * Note this is not the same thing as whether the session associated with
41 * the request is currently persistent, as the session might have been
42 * first made persistent during this request.
44 * @param WebRequest $request
46 * @throws \\OverflowException if there are multiple sessions tied for top
47 * priority in the request. Exception has a property "sessionInfos"
48 * holding the SessionInfo objects for the sessions involved.
50 public function getPersistedSessionId( WebRequest
$request );
53 * Fetch the session for a request
55 * @note You probably want to use $request->getSession() instead. It's more
56 * efficient and doesn't break FauxRequests or sessions that were changed
57 * by $this->getSessionById() or $this->getEmptySession().
58 * @param WebRequest $request Any existing associated session will be reset
59 * to the session corresponding to the data in the request itself.
61 * @throws \\OverflowException if there are multiple sessions tied for top
62 * priority in the request. Exception has a property "sessionInfos"
63 * holding the SessionInfo objects for the sessions involved.
65 public function getSessionForRequest( WebRequest
$request );
68 * Fetch a session by ID
70 * @param bool $create If no session exists for $id, try to create a new one.
71 * May still return null if a session for $id exists but cannot be loaded.
72 * @param WebRequest|null $request Corresponding request. Any existing
73 * session associated with this WebRequest object will be overwritten.
74 * @return Session|null
76 public function getSessionById( $id, $create = false, WebRequest
$request = null );
79 * Fetch a new, empty session
81 * The first provider configured that is able to provide an empty session
84 * @param WebRequest|null $request Corresponding request. Any existing
85 * session associated with this WebRequest object will be overwritten.
88 public function getEmptySession( WebRequest
$request = null );
91 * Return the HTTP headers that need varying on.
93 * The return value is such that someone could theoretically do this:
95 * foreach ( $provider->getVaryHeaders() as $header => $options ) {
96 * $outputPage->addVaryHeader( $header, $options );
102 public function getVaryHeaders();
105 * Return the list of cookies that need varying on.
108 public function getVaryCookies();