MediaWiki master
MediaWiki\User\TempUser\TempUserConfig Interface Reference

Interface for temporary user creation config and name matching. More...

Inherited by MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

Public Member Functions

 getExpireAfterDays ()
 After how many days do temporary users expire?
 
 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.
 
 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

Interface for temporary user creation config and name matching.

This is separate from TempUserCreator to avoid dependency loops during service construction, since TempUserCreator needs UserNameUtils which needs TempUserConfig.

Since
1.39

Definition at line 18 of file TempUserConfig.php.

Member Function Documentation

◆ getExpireAfterDays()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ getMatchCondition()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ getMatchPattern()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ getMatchPatterns()

MediaWiki\User\TempUser\TempUserConfig::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[]

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ getNotifyBeforeExpirationDays()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ getPlaceholderName()

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

Get a placeholder name which matches the reserved prefix.

Returns
string

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ isAutoCreateAction()

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

Is the action valid for user auto-creation?

Parameters
string$action
Returns
bool

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ isEnabled()

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

Is temp user creation enabled?

Returns
bool

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ isKnown()

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

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

Returns
bool

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ isReservedName()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ isTempName()

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

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

Parameters
string$name
Returns
bool

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.

◆ shouldAutoCreate()

MediaWiki\User\TempUser\TempUserConfig::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

Implemented in MediaWiki\User\TempUser\RealTempUserConfig, and MediaWiki\User\TempUser\TempUserCreator.


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