52 if ( !array_key_exists(
$providerId, self::$instances ) ) {
71 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
72 throw new MWException( __METHOD__ .
' may only be called from unit tests!' );
74 self::$instances = [];
88 if ( $audience instanceof
User ) {
91 if ( $audience === self::AUDIENCE_PUBLIC ) {
94 if ( $audience === self::AUDIENCE_RAW ) {
97 throw new InvalidArgumentException(
'Invalid audience' );
125 array $idToName, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
140 array $nameToId, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
154 $id, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
157 return $idToName[$id];
171 $name, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
174 return $nameToId[
$name];
189 $id, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
213 User $user, $audience = self::AUDIENCE_PUBLIC,
$flags = self::READ_NORMAL
string $wgCentralIdLookupProvider
Central ID lookup provider to use by default.
$wgCentralIdLookupProviders
Central ID lookup providers Key is the provider ID, value is a specification for ObjectFactory.
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
static resetCache()
Reset internal cache for unit testing.
static factory( $providerId=null)
Fetch a CentralIdLookup.
nameFromCentralId( $id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given a central user ID, return the (local) user name.
isAttached(User $user, $wikiId=null)
Check that a User is attached on the specified wiki.
centralIdFromLocalUser(User $user, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given a local User object, return the central ID.
static CentralIdLookup[] $instances
lookupCentralIds(array $idToName, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given central user IDs, return the (local) user names.
centralIdFromName( $name, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given a (local) user name, return the central ID.
lookupUserNames(array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given (local) user names, return the central IDs.
checkAudience( $audience)
Check that the "audience" parameter is valid.
localUserFromCentralId( $id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL)
Given a central user ID, return a local User object.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getName()
Get the user name, or the IP of an anonymous user.
when a variable name is used in a it is silently declared as a new local masking the global
the array() calling protocol came about after MediaWiki 1.4rc1.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Interface for database access objects.