128 $phpSessionHandling = \RequestContext::getMain()->getConfig()->get(
'PHPSessionHandling' );
129 $this->usePhpSessionHandling = $phpSessionHandling !==
'disable';
133 "Refusing to create session for unverified user {$info->getUserInfo()}"
160 $this->dataDirty =
true;
161 $this->metaDirty =
true;
162 $this->logger->debug(
163 'SessionBackend "{session}" is unsaved, marking dirty in constructor',
165 'session' => $this->
id,
168 $this->data =
$blob[
'data'];
169 if (
isset(
$blob[
'metadata'][
'loggedOut'] ) ) {
170 $this->loggedOut = (
int)
$blob[
'metadata'][
'loggedOut'];
172 if (
isset(
$blob[
'metadata'][
'expires'] ) ) {
173 $this->expires = (
int)
$blob[
'metadata'][
'expires'];
175 $this->metaDirty =
true;
176 $this->logger->debug(
177 'SessionBackend "{session}" metadata dirty due to missing expiration timestamp',
179 'session' => $this->
id,
194 $session =
new Session( $this, $index, $this->logger );
204 unset( $this->requests[$index] );
205 if ( !$this->
shutdown && !count( $this->requests ) ) {
207 $this->provider->getManager()->deregisterSessionBackend( $this );
242 if ( $this->provider->persistsSessionId() ) {
243 $oldId = (
string)$this->
id;
244 $restart = $this->usePhpSessionHandling && $oldId ===
session_id() &&
253 $this->provider->getManager()->changeBackendId( $this );
254 $this->provider->sessionIdWasReset( $this, $oldId );
255 $this->metaDirty =
true;
256 $this->logger->debug(
257 'SessionBackend "{session}" metadata dirty due to ID reset (formerly "{oldId}")',
259 'session' => $this->
id,
271 $this->store->delete( $this->store->makeKey(
'MWSession', $oldId ) );
305 $this->forcePersist =
true;
306 $this->metaDirty =
true;
307 $this->logger->debug(
308 'SessionBackend "{session}" force-persist due to persist()',
310 'session' => $this->
id,
327 $this->logger->debug(
328 'SessionBackend "{session}" Closing PHP session for unpersist',
329 [
'session' => $this->
id ]
336 $this->forcePersist =
true;
337 $this->metaDirty =
true;
341 $this->store->delete( $this->store->makeKey(
'MWSession', (
string)$this->id ) );
362 if ( $this->remember !== (
bool)
$remember ) {
364 $this->metaDirty =
true;
365 $this->logger->debug(
366 'SessionBackend "{session}" metadata dirty due to remember-user change',
368 'session' => $this->
id,
380 if ( !
isset( $this->requests[$index] ) ) {
383 return $this->requests[$index];
399 return $this->provider->getAllowedUserRights( $this );
407 return $this->provider->canChangeUser();
420 'Cannot set user on this session; check $session->canSetUser() first'
425 $this->metaDirty =
true;
426 $this->logger->debug(
427 'SessionBackend "{session}" metadata dirty due to user change',
429 'session' => $this->
id,
440 if ( !
isset( $this->requests[$index] ) ) {
443 return $this->provider->suggestLoginUsername( $this->requests[$index] );
459 if ( $this->forceHTTPS !== (
bool)$force ) {
460 $this->forceHTTPS = (
bool)$force;
461 $this->metaDirty =
true;
462 $this->logger->debug(
463 'SessionBackend "{session}" metadata dirty due to force-HTTPS change',
465 'session' => $this->
id,
485 if ( $this->loggedOut !== $ts ) {
486 $this->loggedOut = $ts;
487 $this->metaDirty =
true;
488 $this->logger->debug(
489 'SessionBackend "{session}" metadata dirty due to logged-out-timestamp change',
491 'session' => $this->
id,
512 if ( $metadata !==
null && !
is_array( $metadata ) ) {
515 if ( $this->providerMetadata !== $metadata ) {
516 $this->providerMetadata = $metadata;
517 $this->metaDirty =
true;
518 $this->logger->debug(
519 'SessionBackend "{session}" metadata dirty due to provider metadata change',
521 'session' => $this->
id,
549 foreach ( $newData as $key =>
$value ) {
552 $this->dataDirty =
true;
553 $this->logger->debug(
554 'SessionBackend "{session}" data dirty due to addData(): {callers}',
556 'session' => $this->
id,
568 $this->dataDirty =
true;
569 $this->logger->debug(
570 'SessionBackend "{session}" data dirty due to dirty(): {callers}',
572 'session' => $this->
id,
584 if ( time() + $this->lifetime / 2 > $this->expires ) {
585 $this->metaDirty =
true;
586 $this->logger->debug(
587 'SessionBackend "{callers}" metadata dirty for renew(): {callers}',
589 'session' => $this->
id,
593 $this->forcePersist =
true;
594 $this->logger->debug(
595 'SessionBackend "{session}" force-persist for renew(): {callers}',
597 'session' => $this->
id,
641 public function save( $closing =
false ) {
642 $anon = $this->user->isAnon();
644 if ( !$anon && $this->provider->getManager()->isUserSessionPrevented( $this->user->getName() ) ) {
645 $this->logger->debug(
646 'SessionBackend "{session}" not saving, user {user} was ' .
647 'passed to SessionManager::preventSessionsForUser',
649 'session' => $this->
id,
650 'user' => $this->user,
657 if ( !$anon && !$this->user->getToken(
false ) ) {
658 $this->logger->debug(
659 'SessionBackend "{session}" creating token for user {user} on save',
661 'session' => $this->
id,
662 'user' => $this->user,
664 $this->user->setToken();
668 \DeferredUpdates::addCallableUpdate(
function () use ( $user ) {
669 $user->saveSettings();
672 $this->metaDirty =
true;
676 if ( !$this->metaDirty && !$this->dataDirty &&
679 $this->logger->debug(
680 'SessionBackend "{session}" data dirty due to hash mismatch, {expected} !== {got}',
682 'session' => $this->
id,
683 'expected' => $this->dataHash,
686 $this->dataDirty =
true;
689 if ( !$this->metaDirty && !$this->dataDirty && !$this->forcePersist ) {
693 $this->logger->debug(
694 'SessionBackend "{session}" save: dataDirty={dataDirty} ' .
695 'metaDirty={metaDirty} forcePersist={forcePersist}',
697 'session' => $this->
id,
698 'dataDirty' => (
int)$this->dataDirty,
699 'metaDirty' => (
int)$this->metaDirty,
700 'forcePersist' => (
int)$this->forcePersist,
704 if ( $this->metaDirty || $this->forcePersist ) {
706 foreach ( $this->requests as
$request ) {
708 $this->provider->persistSession( $this,
$request );
714 foreach ( $this->requests as
$request ) {
715 if (
$request->getSessionId() === $this->id ) {
716 $this->provider->unpersistSession(
$request );
722 $this->forcePersist =
false;
724 if ( !$this->metaDirty && !$this->dataDirty ) {
729 $metadata = $origMetadata = [
730 'provider' => (
string)$this->provider,
731 'providerMetadata' => $this->providerMetadata,
732 'userId' => $anon ? 0 : $this->user->getId(),
734 'userToken' => $anon ?
null : $this->user->getToken(),
742 \Hooks::run(
'SessionMetadata', [ $this, &$metadata, $this->requests ] );
744 foreach ( $origMetadata as $k => $v ) {
745 if ( $metadata[$k] !== $v ) {
750 $flags = $this->
persist ? 0 : CachedBagOStuff::WRITE_CACHE_ONLY;
751 $flags |= CachedBagOStuff::WRITE_SYNC;
753 $this->store->makeKey(
'MWSession', (
string)$this->id ),
755 'data' => $this->data,
756 'metadata' => $metadata,
758 $metadata[
'expires'],
762 $this->metaDirty =
false;
763 $this->dataDirty =
false;
765 $this->expires = $metadata[
'expires'];
773 if ( !$this->checkPHPSessionRecursionGuard ) {
774 $this->checkPHPSessionRecursionGuard =
true;
776 $this->checkPHPSessionRecursionGuard =
false;
782 $this->logger->debug(
783 'SessionBackend "{session}" Taking over PHP session',
785 'session' => $this->
id,
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
wfReadOnly()
Check whether the wiki is in read-only mode.
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
Wrapper around a BagOStuff that caches data in memory.
makeKey( $class, $component=null)
Make a cache key, scoped to this instance's keyspace.
get( $key, $flags=0)
Get an item with the given key.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static isValidUserName( $name)
Is the input a valid username?
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 save
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
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))