MediaWiki master
MediaWiki\User\TempUser\RealTempUserConfig Class Reference

The real TempUserConfig including internal methods used by TempUserCreator. More...

Inherits MediaWiki\User\TempUser\TempUserConfig.

Collaboration diagram for MediaWiki\User\TempUser\RealTempUserConfig:

Public Member Functions

 __construct ( $config)
 
 getExpireAfterDays ()
 After how many days do temporary users expire?
 
 getGeneratorPattern ()
 
 getMatchCondition (IReadableDatabase $db, string $field, string $op)
 Get a SQL query condition that will match (or not match) temporary accounts.
 
 getMatchPattern ()
 Get a Pattern indicating how temporary account can be detected.
 
 getMatchPatterns ()
 Get Patterns indicating how temporary account can be detected.
 
 getNotifyBeforeExpirationDays ()
 How many days before expiration should temporary users be notified?
 
 getPlaceholderName ()
 Get a placeholder name which matches the reserved prefix.
 
 getSerialMappingConfig ()
 
 getSerialProviderConfig ()
 
 isAutoCreateAction (string $action)
 Is the action valid for user auto-creation?
 
 isEnabled ()
 Is temp user creation enabled?
 
 isKnown ()
 Are temporary accounts a known concept on the wiki? This should return true if any temporary accounts exist.
 
 isReservedName (string $name)
 Does the name match a configured pattern which indicates that it conflicts with temporary user names? Should manual user creation be denied?
 
 isTempName (string $name)
 Does the name match the configured pattern indicating that it is a temporary auto-created user?
 
 shouldAutoCreate (Authority $authority, string $action)
 Should/would auto-create be performed if the user attempts to perform the given action?
 

Detailed Description

The real TempUserConfig including internal methods used by TempUserCreator.

Since
1.39

Definition at line 19 of file RealTempUserConfig.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\TempUser\RealTempUserConfig::__construct ( $config)
Parameters
array$configSee the documentation of $wgAutoCreateTempUser.
  • known: bool
  • enabled: bool
  • actions: array
  • genPattern: string
  • matchPattern: string|string[], optional
  • reservedPattern: string, optional
  • serialProvider: array
  • serialMapping: array
  • expireAfterDays: int, optional
  • notifyBeforeExpirationDays: int, optional

Definition at line 63 of file RealTempUserConfig.php.

Member Function Documentation

◆ getExpireAfterDays()

MediaWiki\User\TempUser\RealTempUserConfig::getExpireAfterDays ( )

After how many days do temporary users expire?

Note
expireTemporaryAccounts.php maintenance script needs to be periodically executed for temp account expiry to work.
Since
1.42
Returns
int|null Null if temp accounts should never expire

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 191 of file RealTempUserConfig.php.

◆ getGeneratorPattern()

MediaWiki\User\TempUser\RealTempUserConfig::getGeneratorPattern ( )
Access: internal
For TempUserCreator only
Returns
Pattern

Definition at line 203 of file RealTempUserConfig.php.

◆ getMatchCondition()

MediaWiki\User\TempUser\RealTempUserConfig::getMatchCondition ( IReadableDatabase $db,
string $field,
string $op )

Get a SQL query condition that will match (or not match) temporary accounts.

Since
1.42
Parameters
IReadableDatabase$db
string$fieldDatabase field to match against
string$opOperator: IExpression::LIKE or IExpression::NOT_LIKE
Returns
IExpression

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 170 of file RealTempUserConfig.php.

References Wikimedia\Rdbms\IReadableDatabase\expr().

◆ getMatchPattern()

MediaWiki\User\TempUser\RealTempUserConfig::getMatchPattern ( )

Get a Pattern indicating how temporary account can be detected.

Used to avoid selecting a temp account via select queries.

Deprecated
since 1.42. Use ::getMatchPatterns as multiple patterns may be defined.
Returns
Pattern

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 151 of file RealTempUserConfig.php.

◆ getMatchPatterns()

MediaWiki\User\TempUser\RealTempUserConfig::getMatchPatterns ( )

Get Patterns indicating how temporary account can be detected.

Used to avoid selecting a temp account via select queries.

Since
1.42
Returns
Pattern[]

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 162 of file RealTempUserConfig.php.

◆ getNotifyBeforeExpirationDays()

MediaWiki\User\TempUser\RealTempUserConfig::getNotifyBeforeExpirationDays ( )

How many days before expiration should temporary users be notified?

Note
expireTemporaryAccounts.php maintenance script needs to be periodically executed for temp account expiry to work.
Since
1.42
Returns
int|null Null if temp accounts should never be notified before expiration

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 195 of file RealTempUserConfig.php.

◆ getPlaceholderName()

MediaWiki\User\TempUser\RealTempUserConfig::getPlaceholderName ( )

Get a placeholder name which matches the reserved prefix.

Returns
string

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 139 of file RealTempUserConfig.php.

◆ getSerialMappingConfig()

MediaWiki\User\TempUser\RealTempUserConfig::getSerialMappingConfig ( )
Access: internal
For TempUserCreator only
Returns
array

Definition at line 223 of file RealTempUserConfig.php.

Referenced by MediaWiki\User\TempUser\TempUserCreator\__construct().

◆ getSerialProviderConfig()

MediaWiki\User\TempUser\RealTempUserConfig::getSerialProviderConfig ( )
Access: internal
For TempUserCreator only
Returns
array

Definition at line 215 of file RealTempUserConfig.php.

Referenced by MediaWiki\User\TempUser\TempUserCreator\__construct().

◆ isAutoCreateAction()

MediaWiki\User\TempUser\RealTempUserConfig::isAutoCreateAction ( string $action)

Is the action valid for user auto-creation?

Parameters
string$action
Returns
bool

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 109 of file RealTempUserConfig.php.

References MediaWiki\User\TempUser\RealTempUserConfig\isEnabled().

Referenced by MediaWiki\User\TempUser\RealTempUserConfig\shouldAutoCreate().

◆ isEnabled()

MediaWiki\User\TempUser\RealTempUserConfig::isEnabled ( )

Is temp user creation enabled?

Returns
bool

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 101 of file RealTempUserConfig.php.

Referenced by MediaWiki\User\TempUser\RealTempUserConfig\isAutoCreateAction().

◆ isKnown()

MediaWiki\User\TempUser\RealTempUserConfig::isKnown ( )

Are temporary accounts a known concept on the wiki? This should return true if any temporary accounts exist.

Returns
bool

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 105 of file RealTempUserConfig.php.

Referenced by MediaWiki\User\TempUser\RealTempUserConfig\isTempName().

◆ isReservedName()

MediaWiki\User\TempUser\RealTempUserConfig::isReservedName ( string $name)

Does the name match a configured pattern which indicates that it conflicts with temporary user names? Should manual user creation be denied?

Parameters
string$name
Returns
mixed

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 135 of file RealTempUserConfig.php.

References MediaWiki\User\TempUser\RealTempUserConfig\isTempName().

◆ isTempName()

MediaWiki\User\TempUser\RealTempUserConfig::isTempName ( string $name)

Does the name match the configured pattern indicating that it is a temporary auto-created user?

Parameters
string$name
Returns
bool

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 123 of file RealTempUserConfig.php.

References MediaWiki\User\TempUser\RealTempUserConfig\isKnown().

Referenced by MediaWiki\User\TempUser\RealTempUserConfig\isReservedName().

◆ shouldAutoCreate()

MediaWiki\User\TempUser\RealTempUserConfig::shouldAutoCreate ( Authority $authority,
string $action )

Should/would auto-create be performed if the user attempts to perform the given action?

Since
1.41
Parameters
Authority$authority
string$action
Returns
bool

Implements MediaWiki\User\TempUser\TempUserConfig.

Definition at line 117 of file RealTempUserConfig.php.

References MediaWiki\Permissions\Authority\isAllowed(), MediaWiki\User\TempUser\RealTempUserConfig\isAutoCreateAction(), and MediaWiki\Permissions\Authority\isRegistered().


The documentation for this class was generated from the following file: