28use Psr\Log\LoggerAwareInterface;
29use Psr\Log\LoggerInterface;
147 if ( self::$instance ===
null ) {
148 self::$instance =
new self(
149 \RequestContext::getMain()->getRequest(),
187 $this->logger->warning(
"Overriding AuthManager primary authn because $why" );
189 if ( $this->primaryAuthenticationProviders !==
null ) {
190 $this->logger->warning(
191 'PrimaryAuthenticationProviders have already been accessed! I hope nothing breaks.'
194 $this->allAuthenticationProviders = array_diff_key(
195 $this->allAuthenticationProviders,
196 $this->primaryAuthenticationProviders
198 $session = $this->request->getSession();
199 $session->remove(
'AuthManager::authnState' );
200 $session->remove(
'AuthManager::accountCreationState' );
201 $session->remove(
'AuthManager::accountLinkState' );
202 $this->createdAccountAuthenticationRequests = [];
205 $this->primaryAuthenticationProviders = [];
206 foreach ( $providers as $provider ) {
208 throw new \RuntimeException(
209 'Expected instance of MediaWiki\\Auth\\PrimaryAuthenticationProvider, got ' .
210 get_class( $provider )
213 $provider->setLogger( $this->logger );
214 $provider->setManager( $this );
215 $provider->setConfig( $this->config );
216 $id = $provider->getUniqueId();
217 if ( isset( $this->allAuthenticationProviders[$id] ) ) {
218 throw new \RuntimeException(
219 "Duplicate specifications for id $id (classes " .
220 get_class( $provider ) .
' and ' .
221 get_class( $this->allAuthenticationProviders[$id] ) .
')'
224 $this->allAuthenticationProviders[$id] = $provider;
225 $this->primaryAuthenticationProviders[$id] = $provider;
262 return $this->request->getSession()->canSetUser();
284 $session = $this->request->getSession();
285 if ( !$session->canSetUser() ) {
287 $session->remove(
'AuthManager::authnState' );
288 throw new \LogicException(
'Authentication is not possible now' );
291 $guessUserName =
null;
292 foreach ( $reqs as
$req ) {
293 $req->returnToUrl = $returnToUrl;
295 if (
$req->username !==
null &&
$req->username !==
'' ) {
296 if ( $guessUserName ===
null ) {
297 $guessUserName =
$req->username;
298 } elseif ( $guessUserName !==
$req->username ) {
299 $guessUserName =
null;
308 $reqs, CreatedAccountAuthenticationRequest::class
311 if ( !in_array(
$req, $this->createdAccountAuthenticationRequests,
true ) ) {
312 throw new \LogicException(
313 'CreatedAccountAuthenticationRequests are only valid on ' .
314 'the same AuthManager that created the account'
318 $user = User::newFromName(
$req->username );
321 throw new \UnexpectedValueException(
322 "CreatedAccountAuthenticationRequest had invalid username \"{$req->username}\""
324 } elseif ( $user->getId() !=
$req->id ) {
325 throw new \UnexpectedValueException(
326 "ID for \"{$req->username}\" was {$user->getId()}, expected {$req->id}"
331 $this->logger->info(
'Logging in {user} after account creation', [
332 'user' => $user->getName(),
337 $session->remove(
'AuthManager::authnState' );
338 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$ret, $user, $user->getName() ] );
345 $status = $provider->testForAuthentication( $reqs );
347 $this->logger->debug(
'Login failed in pre-authentication by ' . $provider->getUniqueId() );
349 Status::wrap(
$status )->getMessage()
352 [ User::newFromName( $guessUserName ) ?:
null,
$ret ]
354 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$ret,
null, $guessUserName ] );
361 'returnToUrl' => $returnToUrl,
362 'guessUserName' => $guessUserName,
364 'primaryResponse' =>
null,
367 'continueRequests' => [],
372 $reqs, CreateFromLoginAuthenticationRequest::class
375 $state[
'maybeLink'] =
$req->maybeLink;
378 $session = $this->request->getSession();
379 $session->setSecret(
'AuthManager::authnState', $state );
408 $session = $this->request->getSession();
410 if ( !$session->canSetUser() ) {
413 throw new \LogicException(
'Authentication is not possible now' );
417 $state = $session->getSecret(
'AuthManager::authnState' );
418 if ( !is_array( $state ) ) {
420 wfMessage(
'authmanager-authn-not-in-progress' )
423 $state[
'continueRequests'] = [];
425 $guessUserName = $state[
'guessUserName'];
427 foreach ( $reqs as
$req ) {
428 $req->returnToUrl = $state[
'returnToUrl'];
433 if ( $state[
'primary'] ===
null ) {
436 $guessUserName =
null;
437 foreach ( $reqs as
$req ) {
438 if (
$req->username !==
null &&
$req->username !==
'' ) {
439 if ( $guessUserName ===
null ) {
440 $guessUserName =
$req->username;
441 } elseif ( $guessUserName !==
$req->username ) {
442 $guessUserName =
null;
447 $state[
'guessUserName'] = $guessUserName;
449 $state[
'reqs'] = $reqs;
452 $res = $provider->beginPrimaryAuthentication( $reqs );
453 switch (
$res->status ) {
455 $state[
'primary'] = $id;
456 $state[
'primaryResponse'] =
$res;
457 $this->logger->debug(
"Primary login with $id succeeded" );
460 $this->logger->debug(
"Login failed in primary authentication by $id" );
461 if (
$res->createRequest || $state[
'maybeLink'] ) {
463 $res->createRequest, $state[
'maybeLink']
467 [ User::newFromName( $guessUserName ) ?:
null,
$res ]
469 $session->remove(
'AuthManager::authnState' );
470 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$res,
null, $guessUserName ] );
477 $this->logger->debug(
"Primary login with $id returned $res->status" );
478 $this->
fillRequests(
$res->neededRequests, self::ACTION_LOGIN, $guessUserName );
479 $state[
'primary'] = $id;
480 $state[
'continueRequests'] =
$res->neededRequests;
481 $session->setSecret(
'AuthManager::authnState', $state );
486 throw new \DomainException(
487 get_class( $provider ) .
"::beginPrimaryAuthentication() returned $res->status"
492 if ( $state[
'primary'] ===
null ) {
493 $this->logger->debug(
'Login failed in primary authentication because no provider accepted' );
495 wfMessage(
'authmanager-authn-no-primary' )
498 [ User::newFromName( $guessUserName ) ?:
null,
$ret ]
500 $session->remove(
'AuthManager::authnState' );
503 } elseif ( $state[
'primaryResponse'] ===
null ) {
509 wfMessage(
'authmanager-authn-not-in-progress' )
512 [ User::newFromName( $guessUserName ) ?:
null,
$ret ]
514 $session->remove(
'AuthManager::authnState' );
518 $id = $provider->getUniqueId();
519 $res = $provider->continuePrimaryAuthentication( $reqs );
520 switch (
$res->status ) {
522 $state[
'primaryResponse'] =
$res;
523 $this->logger->debug(
"Primary login with $id succeeded" );
526 $this->logger->debug(
"Login failed in primary authentication by $id" );
527 if (
$res->createRequest || $state[
'maybeLink'] ) {
529 $res->createRequest, $state[
'maybeLink']
533 [ User::newFromName( $guessUserName ) ?:
null,
$res ]
535 $session->remove(
'AuthManager::authnState' );
536 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$res,
null, $guessUserName ] );
540 $this->logger->debug(
"Primary login with $id returned $res->status" );
541 $this->
fillRequests(
$res->neededRequests, self::ACTION_LOGIN, $guessUserName );
542 $state[
'continueRequests'] =
$res->neededRequests;
543 $session->setSecret(
'AuthManager::authnState', $state );
546 throw new \DomainException(
547 get_class( $provider ) .
"::continuePrimaryAuthentication() returned $res->status"
552 $res = $state[
'primaryResponse'];
553 if (
$res->username ===
null ) {
559 wfMessage(
'authmanager-authn-not-in-progress' )
562 [ User::newFromName( $guessUserName ) ?:
null,
$ret ]
564 $session->remove(
'AuthManager::authnState' );
574 $state[
'maybeLink'][
$res->linkRequest->getUniqueId()] =
$res->linkRequest;
575 $msg =
'authmanager-authn-no-local-user-link';
577 $msg =
'authmanager-authn-no-local-user';
579 $this->logger->debug(
580 "Primary login with {$provider->getUniqueId()} succeeded, but returned no user"
588 if (
$res->createRequest || $state[
'maybeLink'] ) {
590 $res->createRequest, $state[
'maybeLink']
592 $ret->neededRequests[] =
$ret->createRequest;
594 $this->
fillRequests(
$ret->neededRequests, self::ACTION_LOGIN,
null,
true );
595 $session->setSecret(
'AuthManager::authnState', [
598 'primaryResponse' =>
null,
600 'continueRequests' =>
$ret->neededRequests,
608 $user = User::newFromName(
$res->username,
'usable' );
611 throw new \DomainException(
612 get_class( $provider ) .
" returned an invalid username: {$res->username}"
615 if ( $user->getId() === 0 ) {
617 $this->logger->info(
'Auto-creating {user} on login', [
618 'user' => $user->getName(),
623 Status::wrap(
$status )->getMessage(
'authmanager-authn-autocreate-failed' )
626 $session->remove(
'AuthManager::authnState' );
627 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$ret, $user, $user->getName() ] );
634 $beginReqs = $state[
'reqs'];
637 if ( !isset( $state[
'secondary'][$id] ) ) {
641 $func =
'beginSecondaryAuthentication';
642 $res = $provider->beginSecondaryAuthentication( $user, $beginReqs );
643 } elseif ( !$state[
'secondary'][$id] ) {
644 $func =
'continueSecondaryAuthentication';
645 $res = $provider->continueSecondaryAuthentication( $user, $reqs );
649 switch (
$res->status ) {
651 $this->logger->debug(
"Secondary login with $id succeeded" );
654 $state[
'secondary'][$id] =
true;
657 $this->logger->debug(
"Login failed in secondary authentication by $id" );
659 $session->remove(
'AuthManager::authnState' );
660 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$res, $user, $user->getName() ] );
664 $this->logger->debug(
"Secondary login with $id returned " .
$res->status );
665 $this->
fillRequests(
$res->neededRequests, self::ACTION_LOGIN, $user->getName() );
666 $state[
'secondary'][$id] =
false;
667 $state[
'continueRequests'] =
$res->neededRequests;
668 $session->setSecret(
'AuthManager::authnState', $state );
673 throw new \DomainException(
674 get_class( $provider ) .
"::{$func}() returned $res->status"
683 $this->logger->info(
'Login for {user} succeeded from {clientip}', [
684 'user' => $user->getName(),
685 'clientip' => $this->request->getIP(),
689 $beginReqs, RememberMeAuthenticationRequest::class
694 $session->remove(
'AuthManager::authnState' );
696 \Hooks::run(
'AuthManagerLoginAuthenticateAudit', [
$ret, $user, $user->getName() ] );
698 }
catch ( \Exception $ex ) {
699 $session->remove(
'AuthManager::authnState' );
718 $this->logger->debug( __METHOD__ .
": Checking $operation" );
720 $session = $this->request->getSession();
721 $aId = $session->getUser()->getId();
725 $this->logger->info( __METHOD__ .
": Not logged in! $operation is $status" );
729 if ( $session->canSetUser() ) {
730 $id = $session->get(
'AuthManager:lastAuthId' );
731 $last = $session->get(
'AuthManager:lastAuthTimestamp' );
732 if ( $id !== $aId ||
$last ===
null ) {
733 $timeSinceLogin = PHP_INT_MAX;
735 $timeSinceLogin = max( 0, time() -
$last );
738 $thresholds = $this->config->get(
'ReauthenticateTime' );
739 if ( isset( $thresholds[$operation] ) ) {
740 $threshold = $thresholds[$operation];
741 } elseif ( isset( $thresholds[
'default'] ) ) {
742 $threshold = $thresholds[
'default'];
744 throw new \UnexpectedValueException(
'$wgReauthenticateTime lacks a default' );
747 if ( $threshold >= 0 && $timeSinceLogin > $threshold ) {
751 $timeSinceLogin = -1;
753 $pass = $this->config->get(
'AllowSecuritySensitiveOperationIfCannotReauthenticate' );
754 if ( isset( $pass[$operation] ) ) {
756 } elseif ( isset( $pass[
'default'] ) ) {
759 throw new \UnexpectedValueException(
760 '$wgAllowSecuritySensitiveOperationIfCannotReauthenticate lacks a default'
765 \Hooks::run(
'SecuritySensitiveOperationStatus', [
766 &
$status, $operation, $session, $timeSinceLogin
774 $this->logger->info( __METHOD__ .
": $operation is $status" );
790 if ( $provider->testUserCanAuthenticate(
$username ) ) {
814 $normalized = $provider->providerNormalizeUsername(
$username );
815 if ( $normalized !==
null ) {
816 $ret[$normalized] =
true;
819 return array_keys(
$ret );
837 $this->logger->info(
'Revoking access for {user}', [
856 foreach ( $providers as $provider ) {
857 $status = $provider->providerAllowsAuthenticationDataChange(
$req, $checkData );
859 return Status::wrap(
$status );
861 $any = $any ||
$status->value !==
'ignored';
864 $status = Status::newGood(
'ignored' );
865 $status->warning(
'authmanager-change-not-supported' );
868 return Status::newGood();
886 $this->logger->info(
'Changing authentication data for {user} class {what}', [
887 'user' => is_string(
$req->username ) ?
$req->username :
'<no name>',
888 'what' => get_class(
$req ),
895 \BotPassword::invalidateAllPasswordsForUser(
$req->username );
911 switch ( $provider->accountCreationType() ) {
934 'flags' => User::READ_NORMAL,
940 return Status::newFatal(
'authmanager-create-disabled' );
944 return Status::newFatal(
'userexists' );
947 $user = User::newFromName(
$username,
'creatable' );
948 if ( !is_object( $user ) ) {
949 return Status::newFatal(
'noname' );
952 if ( $user->getId() !== 0 ) {
953 return Status::newFatal(
'userexists' );
961 foreach ( $providers as $provider ) {
964 return Status::wrap(
$status );
968 return Status::newGood();
983 $permErrors = \SpecialPage::getTitleFor(
'CreateAccount' )
984 ->getUserPermissionsErrors(
'createaccount', $creator,
'secure' );
987 foreach ( $permErrors as
$args ) {
993 $block = $creator->isBlockedFromCreateAccount();
997 $block->mReason ?:
wfMessage(
'blockednoreason' )->text(),
1002 $errorMessage =
'cantcreateaccount-range-text';
1003 $errorParams[] = $this->
getRequest()->getIP();
1005 $errorMessage =
'cantcreateaccount-text';
1008 return Status::newFatal(
wfMessage( $errorMessage, $errorParams ) );
1013 return Status::newFatal(
'sorbs_create_account_reason' );
1016 return Status::newGood();
1039 $session = $this->request->getSession();
1042 $session->remove(
'AuthManager::accountCreationState' );
1043 throw new \LogicException(
'Account creation is not possible' );
1048 }
catch ( \UnexpectedValueException $ex ) {
1052 $this->logger->debug( __METHOD__ .
': No username provided' );
1059 $this->logger->debug( __METHOD__ .
': {creator} cannot create users: {reason}', [
1061 'creator' => $creator->getName(),
1062 'reason' =>
$status->getWikiText(
null,
null,
'en' )
1068 $username, [
'flags' => User::READ_LOCKING,
'creating' =>
true ]
1071 $this->logger->debug( __METHOD__ .
': {user} cannot be created: {reason}', [
1073 'creator' => $creator->getName(),
1074 'reason' =>
$status->getWikiText(
null,
null,
'en' )
1079 $user = User::newFromName(
$username,
'creatable' );
1080 foreach ( $reqs as
$req ) {
1082 $req->returnToUrl = $returnToUrl;
1087 $session->remove(
'AuthManager::accountCreationState' );
1088 $this->logger->debug( __METHOD__ .
': UserData is invalid: {reason}', [
1089 'user' => $user->getName(),
1090 'creator' => $creator->getName(),
1091 'reason' =>
$status->getWikiText(
null,
null,
'en' ),
1103 'creatorid' => $creator->getId(),
1104 'creatorname' => $creator->getName(),
1106 'returnToUrl' => $returnToUrl,
1108 'primaryResponse' =>
null,
1110 'continueRequests' => [],
1112 'ranPreTests' =>
false,
1117 $reqs, CreateFromLoginAuthenticationRequest::class
1120 $state[
'maybeLink'] =
$req->maybeLink;
1122 if (
$req->createRequest ) {
1123 $reqs[] =
$req->createRequest;
1124 $state[
'reqs'][] =
$req->createRequest;
1128 $session->setSecret(
'AuthManager::accountCreationState', $state );
1129 $session->persist();
1140 $session = $this->request->getSession();
1144 $session->remove(
'AuthManager::accountCreationState' );
1145 throw new \LogicException(
'Account creation is not possible' );
1148 $state = $session->getSecret(
'AuthManager::accountCreationState' );
1149 if ( !is_array( $state ) ) {
1151 wfMessage(
'authmanager-create-not-in-progress' )
1154 $state[
'continueRequests'] = [];
1158 $user = User::newFromName( $state[
'username'],
'creatable' );
1159 if ( !is_object( $user ) ) {
1160 $session->remove(
'AuthManager::accountCreationState' );
1161 $this->logger->debug( __METHOD__ .
': Invalid username', [
1162 'user' => $state[
'username'],
1167 if ( $state[
'creatorid'] ) {
1168 $creator = User::newFromId( $state[
'creatorid'] );
1170 $creator =
new User;
1171 $creator->
setName( $state[
'creatorname'] );
1175 $cache = \ObjectCache::getLocalClusterInstance();
1176 $lock =
$cache->getScopedLock(
$cache->makeGlobalKey(
'account', md5( $user->getName() ) ) );
1180 $this->logger->debug( __METHOD__ .
': Could not acquire account creation lock', [
1181 'user' => $user->getName(),
1182 'creator' => $creator->getName(),
1190 $this->logger->debug( __METHOD__ .
': {creator} cannot create users: {reason}', [
1191 'user' => $user->getName(),
1192 'creator' => $creator->getName(),
1193 'reason' =>
$status->getWikiText(
null,
null,
'en' )
1197 $session->remove(
'AuthManager::accountCreationState' );
1202 $user->load( User::READ_LOCKING );
1204 if ( $state[
'userid'] === 0 ) {
1205 if ( $user->getId() != 0 ) {
1206 $this->logger->debug( __METHOD__ .
': User exists locally', [
1207 'user' => $user->getName(),
1208 'creator' => $creator->getName(),
1212 $session->remove(
'AuthManager::accountCreationState' );
1216 if ( $user->getId() == 0 ) {
1217 $this->logger->debug( __METHOD__ .
': User does not exist locally when it should', [
1218 'user' => $user->getName(),
1219 'creator' => $creator->getName(),
1220 'expected_id' => $state[
'userid'],
1222 throw new \UnexpectedValueException(
1223 "User \"{$state['username']}\" should exist now, but doesn't!"
1226 if ( $user->getId() != $state[
'userid'] ) {
1227 $this->logger->debug( __METHOD__ .
': User ID/name mismatch', [
1228 'user' => $user->getName(),
1229 'creator' => $creator->getName(),
1230 'expected_id' => $state[
'userid'],
1231 'actual_id' => $user->getId(),
1233 throw new \UnexpectedValueException(
1234 "User \"{$state['username']}\" exists, but " .
1235 "ID {$user->getId()} != {$state['userid']}!"
1239 foreach ( $state[
'reqs'] as
$req ) {
1245 $this->logger->debug( __METHOD__ .
': UserData is invalid: {reason}', [
1246 'user' => $user->getName(),
1247 'creator' => $creator->getName(),
1248 'reason' =>
$status->getWikiText(
null,
null,
'en' ),
1252 $session->remove(
'AuthManager::accountCreationState' );
1258 foreach ( $reqs as
$req ) {
1259 $req->returnToUrl = $state[
'returnToUrl'];
1260 $req->username = $state[
'username'];
1264 if ( !$state[
'ranPreTests'] ) {
1268 foreach ( $providers as $id => $provider ) {
1269 $status = $provider->testForAccountCreation( $user, $creator, $reqs );
1271 $this->logger->debug( __METHOD__ .
": Fail in pre-authentication by $id", [
1272 'user' => $user->getName(),
1273 'creator' => $creator->getName(),
1276 Status::wrap(
$status )->getMessage()
1279 $session->remove(
'AuthManager::accountCreationState' );
1284 $state[
'ranPreTests'] =
true;
1289 if ( $state[
'primary'] ===
null ) {
1295 $res = $provider->beginPrimaryAccountCreation( $user, $creator, $reqs );
1296 switch (
$res->status ) {
1298 $this->logger->debug( __METHOD__ .
": Primary creation passed by $id", [
1299 'user' => $user->getName(),
1300 'creator' => $creator->getName(),
1302 $state[
'primary'] = $id;
1303 $state[
'primaryResponse'] =
$res;
1306 $this->logger->debug( __METHOD__ .
": Primary creation failed by $id", [
1307 'user' => $user->getName(),
1308 'creator' => $creator->getName(),
1311 $session->remove(
'AuthManager::accountCreationState' );
1318 $this->logger->debug( __METHOD__ .
": Primary creation $res->status by $id", [
1319 'user' => $user->getName(),
1320 'creator' => $creator->getName(),
1323 $state[
'primary'] = $id;
1324 $state[
'continueRequests'] =
$res->neededRequests;
1325 $session->setSecret(
'AuthManager::accountCreationState', $state );
1330 throw new \DomainException(
1331 get_class( $provider ) .
"::beginPrimaryAccountCreation() returned $res->status"
1336 if ( $state[
'primary'] ===
null ) {
1337 $this->logger->debug( __METHOD__ .
': Primary creation failed because no provider accepted', [
1338 'user' => $user->getName(),
1339 'creator' => $creator->getName(),
1342 wfMessage(
'authmanager-create-no-primary' )
1345 $session->remove(
'AuthManager::accountCreationState' );
1348 } elseif ( $state[
'primaryResponse'] ===
null ) {
1354 wfMessage(
'authmanager-create-not-in-progress' )
1357 $session->remove(
'AuthManager::accountCreationState' );
1361 $id = $provider->getUniqueId();
1362 $res = $provider->continuePrimaryAccountCreation( $user, $creator, $reqs );
1363 switch (
$res->status ) {
1365 $this->logger->debug( __METHOD__ .
": Primary creation passed by $id", [
1366 'user' => $user->getName(),
1367 'creator' => $creator->getName(),
1369 $state[
'primaryResponse'] =
$res;
1372 $this->logger->debug( __METHOD__ .
": Primary creation failed by $id", [
1373 'user' => $user->getName(),
1374 'creator' => $creator->getName(),
1377 $session->remove(
'AuthManager::accountCreationState' );
1381 $this->logger->debug( __METHOD__ .
": Primary creation $res->status by $id", [
1382 'user' => $user->getName(),
1383 'creator' => $creator->getName(),
1386 $state[
'continueRequests'] =
$res->neededRequests;
1387 $session->setSecret(
'AuthManager::accountCreationState', $state );
1390 throw new \DomainException(
1391 get_class( $provider ) .
"::continuePrimaryAccountCreation() returned $res->status"
1399 if ( $state[
'userid'] === 0 ) {
1400 $this->logger->info(
'Creating user {user} during account creation', [
1401 'user' => $user->getName(),
1402 'creator' => $creator->getName(),
1404 $status = $user->addToDatabase();
1409 $session->remove(
'AuthManager::accountCreationState' );
1414 \Hooks::run(
'LocalUserCreated', [ $user,
false ] );
1415 $user->saveSettings();
1416 $state[
'userid'] = $user->getId();
1422 $user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
1425 $logSubtype = $provider->finishAccountCreation( $user, $creator, $state[
'primaryResponse'] );
1428 if ( $this->config->get(
'NewUserLog' ) ) {
1429 $isAnon = $creator->isAnon();
1430 $logEntry = new \ManualLogEntry(
1432 $logSubtype ?: ( $isAnon ?
'create' :
'create2' )
1434 $logEntry->setPerformer( $isAnon ? $user : $creator );
1435 $logEntry->setTarget( $user->getUserPage() );
1438 $state[
'reqs'], CreationReasonAuthenticationRequest::class
1440 $logEntry->setComment(
$req ?
$req->reason :
'' );
1441 $logEntry->setParameters( [
1442 '4::userid' => $user->getId(),
1444 $logid = $logEntry->insert();
1445 $logEntry->publish( $logid );
1451 $beginReqs = $state[
'reqs'];
1454 if ( !isset( $state[
'secondary'][$id] ) ) {
1458 $func =
'beginSecondaryAccountCreation';
1459 $res = $provider->beginSecondaryAccountCreation( $user, $creator, $beginReqs );
1460 } elseif ( !$state[
'secondary'][$id] ) {
1461 $func =
'continueSecondaryAccountCreation';
1462 $res = $provider->continueSecondaryAccountCreation( $user, $creator, $reqs );
1466 switch (
$res->status ) {
1468 $this->logger->debug( __METHOD__ .
": Secondary creation passed by $id", [
1469 'user' => $user->getName(),
1470 'creator' => $creator->getName(),
1474 $state[
'secondary'][$id] =
true;
1478 $this->logger->debug( __METHOD__ .
": Secondary creation $res->status by $id", [
1479 'user' => $user->getName(),
1480 'creator' => $creator->getName(),
1483 $state[
'secondary'][$id] =
false;
1484 $state[
'continueRequests'] =
$res->neededRequests;
1485 $session->setSecret(
'AuthManager::accountCreationState', $state );
1488 throw new \DomainException(
1489 get_class( $provider ) .
"::{$func}() returned $res->status." .
1490 ' Secondary providers are not allowed to fail account creation, that' .
1491 ' should have been done via testForAccountCreation().'
1495 throw new \DomainException(
1496 get_class( $provider ) .
"::{$func}() returned $res->status"
1502 $id = $user->getId();
1503 $name = $user->getName();
1507 $this->createdAccountAuthenticationRequests[] =
$req;
1509 $this->logger->info( __METHOD__ .
': Account creation succeeded for {user}', [
1510 'user' => $user->getName(),
1511 'creator' => $creator->getName(),
1515 $session->remove(
'AuthManager::accountCreationState' );
1518 }
catch ( \Exception $ex ) {
1519 $session->remove(
'AuthManager::accountCreationState' );
1540 if (
$source !== self::AUTOCREATE_SOURCE_SESSION &&
1543 throw new \InvalidArgumentException(
"Unknown auto-creation source: $source" );
1549 $localId = User::idFromName(
$username );
1550 $flags = User::READ_NORMAL;
1555 if ( !$localId &&
wfGetLB()->getReaderIndex() != 0 ) {
1556 $localId = User::idFromName(
$username, User::READ_LATEST );
1557 $flags = User::READ_LATEST;
1562 $this->logger->debug( __METHOD__ .
': {username} already exists locally', [
1565 $user->setId( $localId );
1566 $user->loadFromId(
$flags );
1571 $status->warning(
'userexists' );
1577 $this->logger->debug( __METHOD__ .
': denied by wfReadOnly(): {reason}', [
1582 $user->loadFromId();
1588 $session = $this->request->getSession();
1589 if ( $session->get(
'AuthManager::AutoCreateBlacklist' ) ) {
1590 $this->logger->debug( __METHOD__ .
': blacklisted in session {sessionid}', [
1592 'sessionid' => $session->getId(),
1595 $user->loadFromId();
1596 $reason = $session->get(
'AuthManager::AutoCreateBlacklist' );
1598 return Status::wrap( $reason );
1600 return Status::newFatal( $reason );
1605 if ( !User::isCreatableName(
$username ) ) {
1606 $this->logger->debug( __METHOD__ .
': name "{username}" is not creatable', [
1609 $session->set(
'AuthManager::AutoCreateBlacklist',
'noname' );
1611 $user->loadFromId();
1612 return Status::newFatal(
'noname' );
1617 if ( !$anon->isAllowedAny(
'createaccount',
'autocreateaccount' ) ) {
1618 $this->logger->debug( __METHOD__ .
': IP lacks the ability to create or autocreate accounts', [
1620 'ip' => $anon->getName(),
1622 $session->set(
'AuthManager::AutoCreateBlacklist',
'authmanager-autocreate-noperm' );
1623 $session->persist();
1625 $user->loadFromId();
1626 return Status::newFatal(
'authmanager-autocreate-noperm' );
1630 $cache = \ObjectCache::getLocalClusterInstance();
1633 $this->logger->debug( __METHOD__ .
': Could not acquire account creation lock', [
1637 $user->loadFromId();
1638 return Status::newFatal(
'usernameinprogress' );
1643 'flags' => User::READ_LATEST,
1649 foreach ( $providers as $provider ) {
1653 $this->logger->debug( __METHOD__ .
': Provider denied creation of {username}: {reason}', [
1655 'reason' =>
$ret->getWikiText(
null,
null,
'en' ),
1657 $session->set(
'AuthManager::AutoCreateBlacklist',
$status );
1659 $user->loadFromId();
1664 $backoffKey =
$cache->makeKey(
'AuthManager',
'autocreate-failed', md5(
$username ) );
1665 if (
$cache->get( $backoffKey ) ) {
1666 $this->logger->debug( __METHOD__ .
': {username} denied by prior creation attempt failures', [
1670 $user->loadFromId();
1671 return Status::newFatal(
'authmanager-autocreate-exception' );
1675 $from = isset( $_SERVER[
'REQUEST_URI'] ) ? $_SERVER[
'REQUEST_URI'] :
'CLI';
1676 $this->logger->info( __METHOD__ .
': creating new user ({username}) - from: {from}', [
1682 $trxProfiler = \Profiler::instance()->getTransactionProfiler();
1683 $old = $trxProfiler->setSilenced(
true );
1685 $status = $user->addToDatabase();
1689 if ( $user->getId() ) {
1690 $this->logger->info( __METHOD__ .
': {username} already exists locally (race)', [
1697 $status->warning(
'userexists' );
1699 $this->logger->error( __METHOD__ .
': {username} failed with message {msg}', [
1701 'msg' =>
$status->getWikiText(
null,
null,
'en' )
1704 $user->loadFromId();
1708 }
catch ( \Exception $ex ) {
1709 $trxProfiler->setSilenced( $old );
1710 $this->logger->error( __METHOD__ .
': {username} failed with exception {exception}', [
1715 $cache->set( $backoffKey, 1, 600 );
1725 \Hooks::run(
'AuthPluginAutoCreate', [ $user ],
'1.27' );
1726 \Hooks::run(
'LocalUserCreated', [ $user,
true ] );
1727 $user->saveSettings();
1732 \DeferredUpdates::addCallableUpdate(
function () use ( $user ) {
1733 $user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
1737 if ( $this->config->get(
'NewUserLog' ) ) {
1738 $logEntry = new \ManualLogEntry(
'newusers',
'autocreate' );
1739 $logEntry->setPerformer( $user );
1740 $logEntry->setTarget( $user->getUserPage() );
1741 $logEntry->setComment(
'' );
1742 $logEntry->setParameters( [
1743 '4::userid' => $user->getId(),
1745 $logEntry->insert();
1748 $trxProfiler->setSilenced( $old );
1754 return Status::newGood();
1787 $session = $this->request->getSession();
1788 $session->remove(
'AuthManager::accountLinkState' );
1792 throw new \LogicException(
'Account linking is not possible' );
1795 if ( $user->getId() === 0 ) {
1796 if ( !User::isUsableName( $user->getName() ) ) {
1799 $msg =
wfMessage(
'authmanager-userdoesnotexist', $user->getName() );
1803 foreach ( $reqs as
$req ) {
1804 $req->username = $user->getName();
1805 $req->returnToUrl = $returnToUrl;
1811 foreach ( $providers as $id => $provider ) {
1812 $status = $provider->testForAccountLink( $user );
1814 $this->logger->debug( __METHOD__ .
": Account linking pre-check failed by $id", [
1815 'user' => $user->getName(),
1818 Status::wrap(
$status )->getMessage()
1826 'username' => $user->getName(),
1827 'userid' => $user->getId(),
1828 'returnToUrl' => $returnToUrl,
1830 'continueRequests' => [],
1834 foreach ( $providers as $id => $provider ) {
1839 $res = $provider->beginPrimaryAccountLink( $user, $reqs );
1840 switch (
$res->status ) {
1842 $this->logger->info(
"Account linked to {user} by $id", [
1843 'user' => $user->getName(),
1849 $this->logger->debug( __METHOD__ .
": Account linking failed by $id", [
1850 'user' => $user->getName(),
1861 $this->logger->debug( __METHOD__ .
": Account linking $res->status by $id", [
1862 'user' => $user->getName(),
1864 $this->
fillRequests(
$res->neededRequests, self::ACTION_LINK, $user->getName() );
1865 $state[
'primary'] = $id;
1866 $state[
'continueRequests'] =
$res->neededRequests;
1867 $session->setSecret(
'AuthManager::accountLinkState', $state );
1868 $session->persist();
1873 throw new \DomainException(
1874 get_class( $provider ) .
"::beginPrimaryAccountLink() returned $res->status"
1880 $this->logger->debug( __METHOD__ .
': Account linking failed because no provider accepted', [
1881 'user' => $user->getName(),
1884 wfMessage(
'authmanager-link-no-primary' )
1896 $session = $this->request->getSession();
1900 $session->remove(
'AuthManager::accountLinkState' );
1901 throw new \LogicException(
'Account linking is not possible' );
1904 $state = $session->getSecret(
'AuthManager::accountLinkState' );
1905 if ( !is_array( $state ) ) {
1907 wfMessage(
'authmanager-link-not-in-progress' )
1910 $state[
'continueRequests'] = [];
1914 $user = User::newFromName( $state[
'username'],
'usable' );
1915 if ( !is_object( $user ) ) {
1916 $session->remove(
'AuthManager::accountLinkState' );
1919 if ( $user->getId() != $state[
'userid'] ) {
1920 throw new \UnexpectedValueException(
1921 "User \"{$state['username']}\" is valid, but " .
1922 "ID {$user->getId()} != {$state['userid']}!"
1926 foreach ( $reqs as
$req ) {
1927 $req->username = $state[
'username'];
1928 $req->returnToUrl = $state[
'returnToUrl'];
1938 wfMessage(
'authmanager-link-not-in-progress' )
1941 $session->remove(
'AuthManager::accountLinkState' );
1945 $id = $provider->getUniqueId();
1946 $res = $provider->continuePrimaryAccountLink( $user, $reqs );
1947 switch (
$res->status ) {
1949 $this->logger->info(
"Account linked to {user} by $id", [
1950 'user' => $user->getName(),
1953 $session->remove(
'AuthManager::accountLinkState' );
1956 $this->logger->debug( __METHOD__ .
": Account linking failed by $id", [
1957 'user' => $user->getName(),
1960 $session->remove(
'AuthManager::accountLinkState' );
1964 $this->logger->debug( __METHOD__ .
": Account linking $res->status by $id", [
1965 'user' => $user->getName(),
1967 $this->
fillRequests(
$res->neededRequests, self::ACTION_LINK, $user->getName() );
1968 $state[
'continueRequests'] =
$res->neededRequests;
1969 $session->setSecret(
'AuthManager::accountLinkState', $state );
1972 throw new \DomainException(
1973 get_class( $provider ) .
"::continuePrimaryAccountLink() returned $res->status"
1976 }
catch ( \Exception $ex ) {
1977 $session->remove(
'AuthManager::accountLinkState' );
2009 $providerAction = $action;
2012 switch ( $action ) {
2021 $state = $this->request->getSession()->getSecret(
'AuthManager::authnState' );
2022 return is_array( $state ) ? $state[
'continueRequests'] : [];
2025 $state = $this->request->getSession()->getSecret(
'AuthManager::accountCreationState' );
2026 return is_array( $state ) ? $state[
'continueRequests'] : [];
2044 $state = $this->request->getSession()->getSecret(
'AuthManager::accountLinkState' );
2045 return is_array( $state ) ? $state[
'continueRequests'] : [];
2055 throw new \DomainException( __METHOD__ .
": Invalid action \"$action\"" );
2072 $providerAction, array
$options, array $providers,
User $user =
null
2074 $user = $user ?: \RequestContext::getMain()->getUser();
2075 $options[
'username'] = $user->isAnon() ? null : $user->getName();
2079 foreach ( $providers as $provider ) {
2081 foreach ( $provider->getAuthenticationRequests( $providerAction,
$options ) as
$req ) {
2082 $id =
$req->getUniqueId();
2086 if (
$req->required ) {
2092 !isset( $reqs[$id] )
2102 switch ( $providerAction ) {
2110 if (
$options[
'username'] !==
null ) {
2121 if ( $providerAction === self::ACTION_CHANGE || $providerAction === self::ACTION_REMOVE ) {
2122 $reqs = array_filter( $reqs,
function (
$req ) {
2127 return array_values( $reqs );
2138 foreach ( $reqs as
$req ) {
2139 if ( !
$req->action || $forceAction ) {
2140 $req->action = $action;
2142 if (
$req->username ===
null ) {
2178 foreach ( $providers as $provider ) {
2179 if ( !$provider->providerAllowsPropertyChange(
$property ) ) {
2196 if ( isset( $this->allAuthenticationProviders[$id] ) ) {
2197 return $this->allAuthenticationProviders[$id];
2202 if ( isset( $providers[$id] ) ) {
2203 return $providers[$id];
2206 if ( isset( $providers[$id] ) ) {
2207 return $providers[$id];
2210 if ( isset( $providers[$id] ) ) {
2211 return $providers[$id];
2231 $session = $this->request->getSession();
2232 $arr = $session->getSecret(
'authData' );
2233 if ( !is_array( $arr ) ) {
2237 $session->setSecret(
'authData', $arr );
2248 $arr = $this->request->getSession()->getSecret(
'authData' );
2249 if ( is_array( $arr ) && array_key_exists( $key, $arr ) ) {
2262 $session = $this->request->getSession();
2263 if ( $key ===
null ) {
2264 $session->remove(
'authData' );
2266 $arr = $session->getSecret(
'authData' );
2267 if ( is_array( $arr ) && array_key_exists( $key, $arr ) ) {
2268 unset( $arr[$key] );
2269 $session->setSecret(
'authData', $arr );
2282 foreach ( $specs as &$spec ) {
2283 $spec = [
'sort2' => $i++ ] + $spec + [
'sort' => 0 ];
2286 usort( $specs,
function ( $a, $b ) {
2287 return ( (
int)$a[
'sort'] ) - ( (
int)$b[
'sort'] )
2288 ?: $a[
'sort2'] - $b[
'sort2'];
2292 foreach ( $specs as $spec ) {
2293 $provider = \ObjectFactory::getObjectFromSpec( $spec );
2294 if ( !$provider instanceof $class ) {
2295 throw new \RuntimeException(
2296 "Expected instance of $class, got " . get_class( $provider )
2299 $provider->setLogger( $this->logger );
2300 $provider->setManager( $this );
2301 $provider->setConfig( $this->config );
2302 $id = $provider->getUniqueId();
2303 if ( isset( $this->allAuthenticationProviders[$id] ) ) {
2304 throw new \RuntimeException(
2305 "Duplicate specifications for id $id (classes " .
2306 get_class( $provider ) .
' and ' .
2307 get_class( $this->allAuthenticationProviders[$id] ) .
')'
2310 $this->allAuthenticationProviders[$id] = $provider;
2311 $ret[$id] = $provider;
2321 return $this->config->get(
'AuthManagerConfig' ) ?: $this->config->get(
'AuthManagerAutoConfig' );
2329 if ( $this->preAuthenticationProviders ===
null ) {
2332 PreAuthenticationProvider::class, $conf[
'preauth']
2343 if ( $this->primaryAuthenticationProviders ===
null ) {
2346 PrimaryAuthenticationProvider::class, $conf[
'primaryauth']
2357 if ( $this->secondaryAuthenticationProviders ===
null ) {
2360 SecondaryAuthenticationProvider::class, $conf[
'secondaryauth']
2372 $session = $this->request->getSession();
2373 $delay = $session->delaySave();
2375 $session->resetId();
2376 $session->resetAllTokens();
2377 if ( $session->canSetUser() ) {
2378 $session->setUser( $user );
2380 if ( $remember !==
null ) {
2381 $session->setRememberUser( $remember );
2383 $session->set(
'AuthManager:lastAuthId', $user->getId() );
2384 $session->set(
'AuthManager:lastAuthTimestamp', time() );
2385 $session->persist();
2387 \Wikimedia\ScopedCallback::consume( $delay );
2389 \Hooks::run(
'UserLoggedIn', [ $user ] );
2401 $lang = $useContextLang ? \RequestContext::getMain()->getLanguage() :
$wgContLang;
2402 $user->setOption(
'language',
$lang->getPreferredVariant() );
2405 $user->setOption(
'variant',
$wgContLang->getPreferredVariant() );
2425 foreach ( $providers as $provider ) {
2426 call_user_func_array( [ $provider, $method ],
$args );
2435 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
2437 throw new \MWException( __METHOD__ .
' may only be called from unit tests!' );
2441 self::$instance =
null;
$wgAuth $wgAuth
Authentication plugin.
wfGetLB( $wiki=false)
Get a load balancer object.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
Class for handling updates to the site_stats table.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
isDnsBlacklisted( $ip, $checkWhitelist=false)
Whether the given IP is in a DNS blacklist.
setName( $str)
Set the user name.
setId( $v)
Set the user and reload all fields according to a given ID.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
this hook is for auditing only $req
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
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 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
it s the revision text itself In either if gzip is the revision text is gzipped $flags
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 noclasses & $ret
this hook is for auditing only or null if authentication failed before getting that far $username
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
Interface for configuration instances.
if(!isset( $args[0])) $lang