MediaWiki  1.23.8
GenderCache Class Reference

Caches user genders when needed to use correct namespace aliases. More...

Public Member Functions

 doLinkBatch ( $data, $caller='')
 Wrapper for doQuery that processes raw LinkBatch data. More...
 
 doQuery ( $users, $caller='')
 Preloads genders for given list of users. More...
 
 doTitlesArray ( $titles, $caller='')
 Wrapper for doQuery that processes a title or string array. More...
 
 getGenderOf ( $username, $caller='')
 Returns the gender for given username. More...
 

Static Public Member Functions

static singleton ()
 

Protected Member Functions

 __construct ()
 
 getDefault ()
 Returns the default gender option in this wiki. More...
 

Protected Attributes

 $cache = array()
 
 $default
 
 $misses = 0
 
 $missLimit = 1000
 

Static Private Member Functions

static normalizeUsername ( $username)
 

Detailed Description

Caches user genders when needed to use correct namespace aliases.

Since
1.18

Definition at line 30 of file GenderCache.php.

Constructor & Destructor Documentation

◆ __construct()

GenderCache::__construct ( )
protected

Definition at line 48 of file GenderCache.php.

Member Function Documentation

◆ doLinkBatch()

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

Wrapper for doQuery that processes raw LinkBatch data.

Parameters
$data
$caller

Definition at line 103 of file GenderCache.php.

References array(), as, doQuery(), and MWNamespace\hasGenderDistinction().

◆ doQuery()

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

Preloads genders for given list of users.

Parameters
$usersList|String: usernames
string$callerthe calling method

Definition at line 145 of file GenderCache.php.

References $comment, $dbr, $default, $name, $res, $value, array(), as, cache, DB_SLAVE, getDefault(), User\isValidUserName(), normalizeUsername(), and wfGetDB().

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

◆ doTitlesArray()

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

Wrapper for doQuery that processes a title or string array.

Since
1.20
Parameters
$titlesList: array of Title objects or strings
string$callerthe calling method

Definition at line 124 of file GenderCache.php.

References $title, $titles, array(), as, doQuery(), MWNamespace\hasGenderDistinction(), and Title\newFromText().

◆ getDefault()

GenderCache::getDefault ( )
protected

Returns the default gender option in this wiki.

Returns
String

Definition at line 55 of file GenderCache.php.

References $default, and User\getDefaultOption().

Referenced by doQuery(), and getGenderOf().

◆ getGenderOf()

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

Returns the gender for given username.

Parameters
string$usernameor User: username
string$callerthe calling method
Returns
String

Definition at line 69 of file GenderCache.php.

References $wgUser, cache, doQuery(), getDefault(), global, normalizeUsername(), and wfDebug().

◆ normalizeUsername()

static GenderCache::normalizeUsername (   $username)
staticprivate

Definition at line 184 of file GenderCache.php.

Referenced by doQuery(), and getGenderOf().

◆ singleton()

Member Data Documentation

◆ $cache

GenderCache::$cache = array()
protected

Definition at line 31 of file GenderCache.php.

◆ $default

GenderCache::$default
protected

Definition at line 32 of file GenderCache.php.

Referenced by doQuery(), and getDefault().

◆ $misses

GenderCache::$misses = 0
protected

Definition at line 33 of file GenderCache.php.

◆ $missLimit

GenderCache::$missLimit = 1000
protected

Definition at line 34 of file GenderCache.php.


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