MediaWiki REL1_41
GenderCache Class Reference

Look up "gender" user preference. More...

Public Member Functions

 __construct (NamespaceInfo $nsInfo=null, IConnectionProvider $dbProvider=null, UserOptionsLookup $userOptionsLookup=null)
 
 doLinkBatch (array $data, $caller='')
 Wrapper for doQuery that processes raw LinkBatch data.
 
 doQuery ( $users, $caller='')
 Preload gender option for multiple user names.
 
 doTitlesArray ( $titles, $caller='')
 Wrapper for doQuery that processes a title array.
 
 getGenderOf ( $username, $caller='')
 Get the gender option for given username.
 

Protected Member Functions

 getDefault ()
 Get the default gender option on this wiki.
 

Protected Attributes

 $cache = []
 
 $default = null
 
 $misses = 0
 
 $missLimit = 1000
 

Detailed Description

Look up "gender" user preference.

This primarily used in MediaWiki\Title\MediaWikiTitleCodec for title formatting of pages in gendered namespace aliases, and in CoreParserFunctions for the {{gender:}} parser function.

Since
1.18

Definition at line 39 of file GenderCache.php.

Constructor & Destructor Documentation

◆ __construct()

GenderCache::__construct ( NamespaceInfo $nsInfo = null,
IConnectionProvider $dbProvider = null,
UserOptionsLookup $userOptionsLookup = null )

Definition at line 50 of file GenderCache.php.

Member Function Documentation

◆ doLinkBatch()

GenderCache::doLinkBatch ( array $data,
$caller = '' )

Wrapper for doQuery that processes raw LinkBatch data.

Parameters
array<int,array<string,mixed>>$data
string | null$caller

Definition at line 106 of file GenderCache.php.

References doQuery().

◆ doQuery()

GenderCache::doQuery ( $users,
$caller = '' )

Preload gender option for multiple user names.

Parameters
string[] | string$usersUsernames
string | null$callerCalling method for database profiling

Definition at line 139 of file GenderCache.php.

References $default, and getDefault().

Referenced by doLinkBatch(), doTitlesArray(), and getGenderOf().

◆ doTitlesArray()

GenderCache::doTitlesArray ( $titles,
$caller = '' )

Wrapper for doQuery that processes a title array.

Since
1.20
Parameters
LinkTarget[]$titles
string | null$callerCalling method for database profiling

Definition at line 123 of file GenderCache.php.

References doQuery().

◆ getDefault()

GenderCache::getDefault ( )
protected

Get the default gender option on this wiki.

Returns
string

Definition at line 65 of file GenderCache.php.

Referenced by doQuery(), and getGenderOf().

◆ getGenderOf()

GenderCache::getGenderOf ( $username,
$caller = '' )

Get the gender option for given username.

Parameters
string | UserIdentity$username
string | null$callerCalling method for database profiling
Returns
string

Definition at line 77 of file GenderCache.php.

References doQuery(), getDefault(), getUser(), and wfDebug().

Member Data Documentation

◆ $cache

GenderCache::$cache = []
protected

Definition at line 40 of file GenderCache.php.

◆ $default

GenderCache::$default = null
protected

Definition at line 41 of file GenderCache.php.

Referenced by doQuery().

◆ $misses

GenderCache::$misses = 0
protected

Definition at line 42 of file GenderCache.php.

◆ $missLimit

GenderCache::$missLimit = 1000
protected

Definition at line 44 of file GenderCache.php.


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