58 parent::__construct();
61 'cookieOptions' => [],
79 $this->priority =
$params[
'priority'];
80 $this->cookieOptions =
$params[
'cookieOptions'];
82 unset( $this->params[
'priority'] );
83 unset( $this->params[
'cookieOptions'] );
92 'callUserSetCookiesHook' =>
false,
98 $this->cookieOptions += [
104 'httpOnly' =>
$config->
get(
'CookieHttpOnly' ),
109 $sessionId = $this->
getCookie( $request, $this->params[
'sessionName'],
'' );
112 'forceHTTPS' => $this->
getCookie( $request,
'forceHTTPS',
'',
false )
115 $info[
'id'] = $sessionId;
116 $info[
'persisted'] =
true;
120 if ( $userId !==
null ) {
123 }
catch ( \InvalidArgumentException $ex ) {
128 if ( $userName !==
null && $userInfo->getName() !== $userName ) {
129 $this->logger->warning(
130 'Session "{session}" requested with mismatched UserID and UserName cookies.',
132 'session' => $sessionId,
135 'cookie_username' => $userName,
136 'username' => $userInfo->getName(),
142 if ( $token !==
null ) {
143 if ( !
hash_equals( $userInfo->getToken(), $token ) ) {
144 $this->logger->warning(
145 'Session "{session}" requested with invalid Token cookie.',
147 'session' => $sessionId,
149 'username' => $userInfo->getName(),
153 $info[
'userInfo'] = $userInfo->verified();
154 $info[
'persisted'] =
true;
156 $info[
'userInfo'] = $userInfo;
168 $this->logger->debug(
169 'Session "{session}" requested without UserID cookie',
171 'session' => $info[
'id'],
195 $this->logger->debug( __METHOD__ .
': Headers already sent' );
205 if ( $this->params[
'callUserSetCookiesHook'] && !$user->isAnon() ) {
206 \Hooks::run(
'UserSetCookies', [ $user, &$sessionData, &$cookies ] );
216 $options[
'secure'] = $this->config->get(
'CookieSecure' );
219 $response->setCookie( $this->params[
'sessionName'], $session->
getId(),
null,
223 foreach ( $cookies as $key =>
$value ) {
228 $expiration = $expirationDuration ? $expirationDuration + time() :
null;
236 if ( $sessionData ) {
237 $session->
addData( $sessionData );
245 $this->logger->debug( __METHOD__ .
': Headers already sent' );
255 $this->params[
'sessionName'], [
'prefix' =>
'' ] + $this->cookieOptions
258 foreach ( $cookies as $key =>
$value ) {
259 $response->clearCookie( $key, $this->cookieOptions );
276 if ( $backend->shouldRememberUser() ) {
281 $expiration = $expirationDuration ? $expirationDuration + time() :
null;
285 $response->setCookie(
'forceHTTPS',
'true', $expiration,
286 [
'prefix' =>
'',
'secure' =>
false ] + $this->cookieOptions );
289 [
'prefix' =>
'',
'secure' =>
false ] + $this->cookieOptions );
299 if ( $loggedOut + 86400 > time() &&
300 $loggedOut !== (
int)$this->
getCookie( $request,
'LoggedOut', $this->cookieOptions[
'prefix'] )
302 $request->response()->setCookie(
'LoggedOut', $loggedOut, $loggedOut + 86400,
303 $this->cookieOptions );
311 $this->cookieOptions[
'prefix'] .
'Token',
312 $this->cookieOptions[
'prefix'] .
'LoggedOut',
313 $this->params[
'sessionName'],
319 $name = $this->
getCookie( $request,
'UserName', $this->cookieOptions[
'prefix'] );
320 if ( $name !==
null ) {
332 $prefix = $this->cookieOptions[
'prefix'];
350 if (
$value ===
'deleted' ) {
368 if ( $user->isAnon() ) {
375 'UserID' => $user->getId(),
376 'UserName' => $user->getName(),
377 'Token' => $remember ? (
string)$user->getToken() :
false,
390 if ( !$user->isAnon() && $this->params[
'callUserSetCookiesHook'] ) {
392 'wsUserID' => $user->getId(),
393 'wsToken' => $user->getToken(),
394 'wsUserName' => $user->getName(),
402 return wfMessage(
'sessionprovider-nocookies' );
417 return [
'UserID',
'UserName',
'Token' ];
432 $normalExpiration = $this->config->get(
'CookieExpiration' );
434 if ( $shouldRememberUser &&
in_array( $cookieName, $extendedCookies,
true ) ) {
435 $extendedExpiration = $this->config->get(
'ExtendedLoginCookieExpiration' );
437 return ( $extendedExpiration !==
null ) ? (
int)$extendedExpiration : (
int)$normalExpiration;
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
Allows to change the fields on the form that will be generated $name
this hook is for auditing only $response
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".