MediaWiki  REL1_22
GenderCache Class Reference

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

List of all members.

Public Member Functions

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

Static Public Member Functions

static singleton ()

Protected Member Functions

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

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

GenderCache::__construct ( ) [protected]

Definition at line 47 of file GenderCache.php.


Member Function Documentation

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

Wrapper for doQuery that processes raw LinkBatch data.

Parameters:
$data
$caller

Definition at line 100 of file GenderCache.php.

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

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

Preloads genders for given list of users.

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

Definition at line 142 of file GenderCache.php.

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

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

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 121 of file GenderCache.php.

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

GenderCache::getDefault ( ) [protected]

Returns the default gender option in this wiki.

Returns:
String

Definition at line 53 of file GenderCache.php.

References User\getDefaultOption().

Referenced by doQuery(), and 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 66 of file GenderCache.php.

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

static GenderCache::normalizeUsername ( username) [static, private]

Definition at line 181 of file GenderCache.php.

Referenced by doQuery(), and getGenderOf().


Member Data Documentation

GenderCache::$cache = array() [protected]

Definition at line 31 of file GenderCache.php.

GenderCache::$default [protected]

Definition at line 32 of file GenderCache.php.

Referenced by doQuery().

GenderCache::$misses = 0 [protected]

Definition at line 33 of file GenderCache.php.

GenderCache::$missLimit = 1000 [protected]

Definition at line 34 of file GenderCache.php.


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