MediaWiki
1.23.0
|
The User object encapsulates all of the user-specific settings (user_id, name, rights, password, email address, options, last login time). More...
Public Attributes | |
const | EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX |
const | MAX_WATCHED_ITEMS_CACHE = 100 |
Maximum items in $mWatchedItems. More... | |
const | MW_USER_VERSION = MW_USER_VERSION |
const | USER_TOKEN_LENGTH = USER_TOKEN_LENGTH |
Global constants made accessible as class constants so that autoloader magic can be used. More... | |
Static Public Attributes | |
static | $mAllRights = false |
String Cached results of getAllRights() More... | |
static | $mCacheVars |
Array of Strings List of member variables which are saved to the shared cache (memcached). More... | |
static | $mCoreRights |
Array of Strings Core rights. More... | |
Cache variables | |
$mId | |
Bool Whether the cache variables have been loaded. More... | |
$mName | |
Bool Whether the cache variables have been loaded. More... | |
$mRealName | |
Bool Whether the cache variables have been loaded. More... | |
$mPassword | |
Bool Whether the cache variables have been loaded. More... | |
$mNewpassword | |
Bool Whether the cache variables have been loaded. More... | |
$mNewpassTime | |
Bool Whether the cache variables have been loaded. More... | |
$mEmail | |
Bool Whether the cache variables have been loaded. More... | |
$mTouched | |
Bool Whether the cache variables have been loaded. More... | |
$mToken | |
Bool Whether the cache variables have been loaded. More... | |
$mEmailAuthenticated | |
Bool Whether the cache variables have been loaded. More... | |
$mEmailToken | |
Bool Whether the cache variables have been loaded. More... | |
$mEmailTokenExpires | |
Bool Whether the cache variables have been loaded. More... | |
$mRegistration | |
Bool Whether the cache variables have been loaded. More... | |
$mEditCount | |
Bool Whether the cache variables have been loaded. More... | |
$mGroups | |
Bool Whether the cache variables have been loaded. More... | |
$mOptionOverrides | |
Bool Whether the cache variables have been loaded. More... | |
$mOptionsLoaded | |
Bool Whether the cache variables have been loaded. More... | |
$mFrom | |
String Initialization data source if mLoadedItems!==true. More... | |
$mNewtalk | |
Lazy-initialized variables, invalidated with clearInstanceCache. More... | |
$mDatePreference | |
Bool Whether the cache variables have been loaded. More... | |
$mBlockedby | |
Bool Whether the cache variables have been loaded. More... | |
$mHash | |
Bool Whether the cache variables have been loaded. More... | |
$mRights | |
Bool Whether the cache variables have been loaded. More... | |
$mBlockreason | |
Bool Whether the cache variables have been loaded. More... | |
$mEffectiveGroups | |
Bool Whether the cache variables have been loaded. More... | |
$mImplicitGroups | |
Bool Whether the cache variables have been loaded. More... | |
$mFormerGroups | |
Bool Whether the cache variables have been loaded. More... | |
$mBlockedGlobally | |
Bool Whether the cache variables have been loaded. More... | |
$mLocked | |
Bool Whether the cache variables have been loaded. More... | |
$mHideName | |
Bool Whether the cache variables have been loaded. More... | |
$mOptions | |
Bool Whether the cache variables have been loaded. More... | |
Block | $mBlock |
Bool Whether the cache variables have been loaded. More... | |
bool | $mAllowUsertalk |
Bool Whether the cache variables have been loaded. More... | |
static | $idCacheByName = array() |
Bool Whether the cache variables have been loaded. More... | |
$mPasswordExpires | |
Bool Whether the cache variables have been loaded. More... | |
$mLoadedItems = array() | |
Array with already loaded items or true if all items have been loaded. More... | |
WebRequest | $mRequest |
Bool Whether the cache variables have been loaded. More... | |
Block | $mBlockedFromCreateAccount = false |
Bool Whether the cache variables have been loaded. More... | |
Array | $mWatchedItems = array() |
Bool Whether the cache variables have been loaded. More... | |
__construct () | |
Lightweight constructor for an anonymous user. More... | |
__toString () | |
load () | |
Load the user table data for this object from the source given by mFrom. More... | |
loadFromId () | |
Load user table data, given mId has already been set. More... | |
saveToCache () | |
Save user data to the shared cache. More... | |
newFrom*() static factory methods | |
isValidPassword ( $password) | |
Is the input a valid password for this user? More... | |
getPasswordValidity ( $password) | |
Given unvalidated password input, return error message on failure. More... | |
checkPasswordValidity ( $password) | |
Check if this is a valid password for this user. More... | |
expirePassword ( $ts=0) | |
Expire a user's password. More... | |
resetPasswordExpiration ( $load=true) | |
Clear the password expiration for a user. More... | |
getPasswordExpired () | |
Check if the user's password is expired. More... | |
getPasswordExpireDate () | |
Get this user's password expiration date. More... | |
loadDefaults ( $name=false) | |
Set cached properties to default. More... | |
isItemLoaded ( $item, $all='all') | |
Return whether an item has been loaded. More... | |
loadFromDatabase () | |
Load user and user_group data from the database. More... | |
loadFromRow ( $row, $data=null) | |
Initialize this object from a row from the user table. More... | |
addAutopromoteOnceGroups ( $event) | |
Add the user to the group if he/she meets given criteria. More... | |
clearInstanceCache ( $reloadFrom=false) | |
Clear various cached data stored in this object. More... | |
isDnsBlacklisted ( $ip, $checkWhitelist=false) | |
Whether the given IP is in a DNS blacklist. More... | |
inDnsBlacklist ( $ip, $bases) | |
Whether the given IP is in a given DNS blacklist. More... | |
isPingLimitable () | |
Is this user subject to rate limiting? More... | |
pingLimiter ( $action='edit', $incrBy=1) | |
Primitive rate limits: enforce maximum actions per time period to put a brake on flooding. More... | |
isBlocked ( $bFromSlave=true) | |
Check if user is blocked. More... | |
getBlock ( $bFromSlave=true) | |
Get the block affecting the user, or null if the user is not blocked. More... | |
isBlockedFrom ( $title, $bFromSlave=false) | |
Check if user is blocked from editing a particular article. More... | |
blockedBy () | |
If user is blocked, return the name of the user who placed the block. More... | |
blockedFor () | |
If user is blocked, return the specified reason for the block. More... | |
getBlockId () | |
If user is blocked, return the ID for the block. More... | |
isBlockedGlobally ( $ip='') | |
Check if user is blocked on all wikis. More... | |
isLocked () | |
Check if user account is locked. More... | |
isHidden () | |
Check if user account is hidden. More... | |
getId () | |
Get the user's ID. More... | |
setId ( $v) | |
Set the user and reload all fields according to a given ID. More... | |
getName () | |
Get the user name, or the IP of an anonymous user. More... | |
setName ( $str) | |
Set the user name. More... | |
getTitleKey () | |
Get the user's name escaped by underscores. More... | |
getNewtalk () | |
Check if the user has new messages. More... | |
getNewMessageLinks () | |
Return the data needed to construct links for new talk page message alerts. More... | |
getNewMessageRevisionId () | |
Get the revision ID for the last talk page revision viewed by the talk page owner. More... | |
setNewtalk ( $val, $curRev=null) | |
Update the 'You have new messages!' status. More... | |
invalidateCache () | |
Immediately touch the user data cache for this account. More... | |
validateCache ( $timestamp) | |
Validate the cache for this account. More... | |
getTouched () | |
Get the user touched timestamp. More... | |
setPassword ( $str) | |
Set the password and reset the random token. More... | |
setInternalPassword ( $str) | |
Set the password and reset the random token unconditionally. More... | |
getToken ( $forceCreation=true) | |
Get the user's current token. More... | |
setToken ( $token=false) | |
Set the random token (used for persistent authentication) Called from loadDefaults() among other places. More... | |
setNewpassword ( $str, $throttle=true) | |
Set the password for a password reminder or new account email. More... | |
isPasswordReminderThrottled () | |
Has password reminder email been sent within the last $wgPasswordReminderResendTime hours? More... | |
getEmail () | |
Get the user's e-mail address. More... | |
getEmailAuthenticationTimestamp () | |
Get the timestamp of the user's e-mail authentication. More... | |
setEmail ( $str) | |
Set the user's e-mail address. More... | |
setEmailWithConfirmation ( $str) | |
Set the user's e-mail address and a confirmation mail if needed. More... | |
getRealName () | |
Get the user's real name. More... | |
setRealName ( $str) | |
Set the user's real name. More... | |
getOption ( $oname, $defaultOverride=null, $ignoreHidden=false) | |
Get the user's current setting for a given option. More... | |
getOptions () | |
Get all user's options. More... | |
getBoolOption ( $oname) | |
Get the user's current setting for a given option, as a boolean value. More... | |
getIntOption ( $oname, $defaultOverride=0) | |
Get the user's current setting for a given option, as an integer value. More... | |
setOption ( $oname, $val) | |
Set the given option for a user. More... | |
getTokenFromOption ( $oname) | |
Get a token stored in the preferences (like the watchlist one), resetting it if it's empty (and saving changes). More... | |
resetTokenFromOption ( $oname) | |
Reset a token stored in the preferences (like the watchlist one). More... | |
getOptionKinds (IContextSource $context, $options=null) | |
Return an associative array mapping preferences keys to the kind of a preference they're used for. More... | |
resetOptions ( $resetKinds=array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused'), IContextSource $context=null) | |
Reset certain (or all) options to the site defaults. More... | |
getDatePreference () | |
Get the user's preferred date format. More... | |
requiresHTTPS () | |
Determine based on the wiki configuration and the user's options, whether this user must be over HTTPS no matter what. More... | |
getStubThreshold () | |
Get the user preferred stub threshold. More... | |
getRights () | |
Get the permissions this user has. More... | |
getGroups () | |
Get the list of explicit group memberships this user has. More... | |
getEffectiveGroups ( $recache=false) | |
Get the list of implicit group memberships this user has. More... | |
getAutomaticGroups ( $recache=false) | |
Get the list of implicit group memberships this user has. More... | |
getFormerGroups () | |
Returns the groups the user has belonged to. More... | |
getEditCount () | |
Get the user's edit count. More... | |
addGroup ( $group) | |
Add the user to the given group. More... | |
removeGroup ( $group) | |
Remove the user from the given group. More... | |
isLoggedIn () | |
Get whether the user is logged in. More... | |
isAnon () | |
Get whether the user is anonymous. More... | |
isAllowedAny () | |
Check if user is allowed to access a feature / make an action. More... | |
isAllowedAll () | |
Is the input a valid password for this user? More... | |
isAllowed ( $action='') | |
Internal mechanics of testing a permission. More... | |
useRCPatrol () | |
Check whether to enable recent changes patrol features for this user. More... | |
useNPPatrol () | |
Check whether to enable new pages patrol features for this user. More... | |
getRequest () | |
Get the WebRequest object to use with this object. More... | |
getSkin () | |
Get the current skin, loading it if required. More... | |
getWatchedItem ( $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS) | |
Get a WatchedItem for this user and $title. More... | |
isWatched ( $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS) | |
Check the watched status of an article. More... | |
addWatch ( $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS) | |
Watch an article. More... | |
removeWatch ( $title, $checkRights=WatchedItem::CHECK_USER_RIGHTS) | |
Stop watching an article. More... | |
clearNotification (&$title, $oldid=0) | |
Clear the user's notification timestamp for the given title. More... | |
clearAllNotifications () | |
Resets all of the given user's page-change notification timestamps. More... | |
setCookies ( $request=null, $secure=null, $rememberMe=false) | |
Set the default cookies for this session on the user's client. More... | |
logout () | |
Log this user out. More... | |
doLogout () | |
Clear the user's cookies and session, and reset the instance cache. More... | |
saveSettings () | |
Save this user's settings into the database. More... | |
idForName () | |
If only this user's username is known, and it exists, return the user ID. More... | |
addToDatabase () | |
Add this existing user object to the database. More... | |
spreadAnyEditBlock () | |
If this user is logged-in and blocked, block any IP address they've successfully logged in from. More... | |
isBlockedFromCreateAccount () | |
Get whether the user is explicitly blocked from account creation. More... | |
isBlockedFromEmailuser () | |
Get whether the user is blocked from using Special:Emailuser. More... | |
isAllowedToCreateAccount () | |
Get whether the user is allowed to create an account. More... | |
getUserPage () | |
Get this user's personal page title. More... | |
getTalkPage () | |
Get this user's talk page title. More... | |
isNewbie () | |
Determine whether the user is a newbie. More... | |
checkPassword ( $password) | |
Check to see if the given clear-text password is one of the accepted passwords. More... | |
checkTemporaryPassword ( $plaintext) | |
Check if the given clear-text password matches the temporary password sent by e-mail for password reset operations. More... | |
editToken ( $salt='', $request=null) | |
Alias for getEditToken. More... | |
getEditToken ( $salt='', $request=null) | |
Initialize (if necessary) and return a session token value which can be used in edit forms to show that the user's login credentials aren't being hijacked with a foreign form submission. More... | |
matchEditToken ( $val, $salt='', $request=null) | |
Check given value against the token value stored in the session. More... | |
matchEditTokenNoSuffix ( $val, $salt='', $request=null) | |
Check given value against the token value stored in the session, ignoring the suffix. More... | |
sendConfirmationMail ( $type='created') | |
Generate a new e-mail confirmation token and send a confirmation/invalidation mail to the user's given address. More... | |
sendMail ( $subject, $body, $from=null, $replyto=null) | |
Send an e-mail to this user's account. More... | |
confirmEmail () | |
Mark the e-mail address confirmed. More... | |
invalidateEmail () | |
Invalidate the user's e-mail confirmation, and unauthenticate the e-mail address if it was already confirmed. More... | |
setEmailAuthenticationTimestamp ( $timestamp) | |
Set the e-mail authentication timestamp. More... | |
canSendEmail () | |
Is this user allowed to send e-mails within limits of current site configuration? More... | |
canReceiveEmail () | |
Is this user allowed to receive e-mails within limits of current site configuration? More... | |
isEmailConfirmed () | |
Is this user's e-mail address valid-looking and confirmed within limits of the current site configuration? More... | |
isEmailConfirmationPending () | |
Check whether there is an outstanding request for e-mail confirmation. More... | |
getRegistration () | |
Get the timestamp of account creation. More... | |
getFirstEditTimestamp () | |
Get the timestamp of the first edit. More... | |
changeableGroups () | |
Returns an array of groups that this user can add and remove. More... | |
incEditCount () | |
Increment the user's edit-count field. More... | |
addNewUserLogEntry ( $action=false, $reason='') | |
Add a newuser log entry for this user. More... | |
addNewUserLogEntryAutoCreate () | |
Add an autocreate newuser log entry for this user Used by things like CentralAuth and perhaps other authplugins. More... | |
static | newFromName ( $name, $validate='valid') |
Static factory method for creation from username. More... | |
static | newFromId ( $id) |
Static factory method for creation from a given user ID. More... | |
static | newFromConfirmationCode ( $code) |
Factory method to fetch whichever user has a given email confirmation code. More... | |
static | newFromSession (WebRequest $request=null) |
Create a new user object using data from session or cookies. More... | |
static | newFromRow ( $row, $data=null) |
Create a new user object from a user row. More... | |
static | whoIs ( $id) |
Get the username corresponding to a given user ID. More... | |
static | whoIsReal ( $id) |
Get the real name of a user given their user ID. More... | |
static | idFromName ( $name) |
Get database id given a user name. More... | |
static | resetIdByNameCache () |
Reset the cache used in idFromName(). More... | |
static | isIP ( $name) |
Does the string match an anonymous IPv4 address? More... | |
static | isValidUserName ( $name) |
Is the input a valid username? More... | |
static | isUsableName ( $name) |
Usernames which fail to pass this function will be blocked from user login and new account registrations, but may be used internally by batch processes. More... | |
static | isCreatableName ( $name) |
Usernames which fail to pass this function will be blocked from new account registrations, but may be used internally either by batch processes or by user accounts which have already been created. More... | |
static | isValidEmailAddr ( $addr) |
Does a string look like an e-mail address? More... | |
static | getCanonicalName ( $name, $validate='valid') |
Given unvalidated user input, return a canonical username, or false if the username is invalid. More... | |
static | edits ( $uid) |
Count the number of edits of a user. More... | |
static | randomPassword () |
Return a random password. More... | |
static | getDefaultOptions () |
Combine the language default options with any site-specific options and add the default language variants. More... | |
static | getDefaultOption ( $opt) |
Get a given default option value. More... | |
static | isLocallyBlockedProxy ( $ip) |
Check if an IP address is in the local proxy list. More... | |
static | listOptionKinds () |
Return a list of the types of user options currently returned by User::getOptionKinds(). More... | |
static | createNew ( $name, $params=array()) |
Add a user to the database, return the user object. More... | |
static | generateToken () |
Generate a looking random token for various uses. More... | |
static | getGroupPermissions ( $groups) |
Get the permissions associated with a given list of groups. More... | |
static | getGroupsWithPermission ( $role) |
Get all the groups who have a given permission. More... | |
static | groupHasPermission ( $group, $role) |
Check, if the given group has the given permission. More... | |
static | isEveryoneAllowed ( $right) |
Check if all users have the given permission. More... | |
static | getGroupName ( $group) |
Get the localized descriptive name for a group, if it exists. More... | |
static | getGroupMember ( $group, $username='#') |
Get the localized descriptive name for a member of a group, if it exists. More... | |
static | getAllGroups () |
Return the set of defined explicit groups. More... | |
static | getAllRights () |
Get a list of all available permissions. More... | |
static | getImplicitGroups () |
Get a list of implicit groups. More... | |
static | getGroupPage ( $group) |
Get the title of a page describing a particular group. More... | |
static | makeGroupLinkHTML ( $group, $text='') |
Create a link to the group in HTML, if available; else return the group name. More... | |
static | makeGroupLinkWiki ( $group, $text='') |
Create a link to the group in Wikitext, if available; else return the group name. More... | |
static | changeableByGroup ( $group) |
Returns an array of the groups that a particular group can add/remove. More... | |
static | getRightDescription ( $right) |
Get the description of a given right. More... | |
static | oldCrypt ( $password, $userId) |
Make an old-style password hash. More... | |
static | crypt ( $password, $salt=false) |
Make a new-style password hash. More... | |
static | comparePasswords ( $hash, $password, $userId=false) |
Compare a password hash with a plain-text password. More... | |
static | passwordChangeInputAttribs () |
Provide an array of HTML5 attributes to put on an input element intended for the user to enter a new password. More... | |
static | selectFields () |
Return the list of user fields that should be selected to create a new user object. More... | |
static | newFatalPermissionDeniedStatus ( $permission) |
Factory function for fatal permission-denied errors. More... | |
setItemLoaded ( $item) | |
Set that an item has been loaded. More... | |
compareSecrets ( $answer, $test) | |
A comparison of two strings, not vulnerable to timing attacks. More... | |
loadFromUserObject ( $user) | |
Load the data for this user object from another user object. More... | |
checkNewtalk ( $field, $id, $fromMaster=false) | |
Internal uncached check for new messages. More... | |
updateNewtalk ( $field, $id, $curRev=null) | |
Add or update the new messages flag. More... | |
deleteNewtalk ( $field, $id) | |
Clear the new messages flag for the given user. More... | |
setCookie ( $name, $value, $exp=0, $secure=null, $params=array()) | |
Set a cookie on the user's client. More... | |
clearCookie ( $name, $secure=null, $params=array()) | |
Clear a cookie on the user's client. More... | |
spreadBlock () | |
If this (non-anonymous) user is blocked, block the IP address they've successfully logged in from. More... | |
confirmationToken (&$expiration) | |
Generate, store, and return a new e-mail confirmation code. More... | |
confirmationTokenUrl ( $token) | |
Return a URL the user can use to confirm their email address. More... | |
invalidationTokenUrl ( $token) | |
Return a URL the user can use to invalidate their email address. More... | |
getTokenUrl ( $page, $token) | |
Internal function to format the e-mail validation/invalidation URLs. More... | |
initEditCount ( $add=0) | |
Initialize user_editcount from data out of the revision table. More... | |
loadOptions ( $data=null) | |
Load the user options either from cache, the database or an array. More... | |
saveOptions () | |
loadFromSession () | |
Load user data from the session or login cookie. More... | |
loadGroups () | |
Load the groups from the database if they aren't already loaded. More... | |
getBlockedStatus ( $bFromSlave=true) | |
Get blocking information. More... | |
clearSharedCache () | |
Clear user data from memcached. More... | |
static | newTouchedTimestamp () |
Generate a current or new-future timestamp to be stored in the user_touched field when we update things. More... | |
The User object encapsulates all of the user-specific settings (user_id, name, rights, password, email address, options, last login time).
Client classes use the getXXX() functions to access these fields. These functions do all the work of determining whether the user is logged in, whether the requested option can be satisfied from cookies or whether a database query is needed. Most of the settings needed for rendering normal pages are set in the cookie to minimize use of the database.
User::__construct | ( | ) |
Lightweight constructor for an anonymous user.
Use the User::newFrom* factory functions for other kinds of users.
Definition at line 255 of file User.php.
References clearInstanceCache().
User::addAutopromoteOnceGroups | ( | $event | ) |
Add the user to the group if he/she meets given criteria.
Contrary to autopromotion by $wgAutopromote, the group will be possible to remove manually via Special:UserRights. In such case it will not be re-added automatically. The user will also not lose the group if they no longer meet the criteria.
string | $event | key in $wgAutopromoteOnce (each one has groups/criteria) |
Definition at line 1284 of file User.php.
References addGroup(), array(), as, Autopromote\getAutopromoteOnceGroups(), getGroups(), getId(), getUserPage(), and global.
User::addGroup | ( | $group | ) |
Add the user to the given group.
This takes immediate effect.
string | $group | Name of the group to add |
Definition at line 2915 of file User.php.
References array(), DB_MASTER, getEffectiveGroups(), getId(), invalidateCache(), loadGroups(), wfGetDB(), and wfRunHooks().
Referenced by addAutopromoteOnceGroups().
User::addNewUserLogEntry | ( | $action = false , |
|
$reason = '' |
|||
) |
Add a newuser log entry for this user.
Before 1.19 the return value was always true.
string | bool | $action | account creation type.
|
string | $reason | user supplied reason |
Definition at line 4594 of file User.php.
References $wgUser, array(), getId(), getName(), getUserPage(), and global.
Referenced by addNewUserLogEntryAutoCreate().
User::addNewUserLogEntryAutoCreate | ( | ) |
Add an autocreate newuser log entry for this user Used by things like CentralAuth and perhaps other authplugins.
Consider calling addNewUserLogEntry() directly instead.
Definition at line 4639 of file User.php.
References addNewUserLogEntry().
User::addToDatabase | ( | ) |
Add this existing user object to the database.
If the user already exists, a fatal status object is returned, and the user object is initialised with the data from the database.
Previously, this function generated a DB error due to a key conflict if the user already existed. Many extension callers use this function in code along the lines of:
$user = User::newFromName( $name ); if ( !$user->isLoggedIn() ) { $user->addToDatabase(); } // do something with $user...
However, this was vulnerable to a race condition (bug 16020). By initialising the user object if the user exists, we aim to support this calling sequence as far as possible.
Note that if the user exists, this function will acquire a write lock, so it is still advisable to make the call conditional on isLoggedIn(), and to commit the transaction after calling.
MWException |
Definition at line 3521 of file User.php.
References $mEmail, $mRealName, array(), clearInstanceCache(), DB_MASTER, load(), loadFromDatabase(), Status\newFatal(), Status\newGood(), newTouchedTimestamp(), saveOptions(), setToken(), and wfGetDB().
Referenced by UserTest\testEditCount(), and UserTest\testOptions().
User::addWatch | ( | $title, | |
$checkRights = WatchedItem::CHECK_USER_RIGHTS |
|||
) |
Watch an article.
$title | Title of the article to look at |
$checkRights | int Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS. |
Definition at line 3135 of file User.php.
References $title, getWatchedItem(), and invalidateCache().
User::blockedBy | ( | ) |
If user is blocked, return the name of the user who placed the block.
Definition at line 1766 of file User.php.
References $mBlockedby, and getBlockedStatus().
Referenced by SpecialBlock\checkUnblockSelf().
User::blockedFor | ( | ) |
If user is blocked, return the specified reason for the block.
Definition at line 1775 of file User.php.
References $mBlockreason, and getBlockedStatus().
User::canReceiveEmail | ( | ) |
Is this user allowed to receive e-mails within limits of current site configuration?
Definition at line 4007 of file User.php.
References getOption(), and isEmailConfirmed().
User::canSendEmail | ( | ) |
Is this user allowed to send e-mails within limits of current site configuration?
Definition at line 3992 of file User.php.
References array(), global, isAllowed(), isEmailConfirmed(), and wfRunHooks().
|
static |
Returns an array of the groups that a particular group can add/remove.
string | $group | the group to check for whether it can add/remove |
Definition at line 4324 of file User.php.
References $value, array(), as, getAllGroups(), and global.
Referenced by changeableGroups().
User::changeableGroups | ( | ) |
Returns an array of groups that this user can add and remove.
Definition at line 4388 of file User.php.
References array(), as, changeableByGroup(), getAllGroups(), getEffectiveGroups(), and isAllowed().
|
protected |
Internal uncached check for new messages.
string | $field | 'user_ip' for anonymous users, 'user_id' otherwise |
string | int | $id | User's IP address for anonymous users, User ID otherwise |
bool | $fromMaster | true to fetch from the master, false for a slave |
Definition at line 2018 of file User.php.
References $ok, array(), DB_MASTER, DB_SLAVE, and wfGetDB().
Referenced by getNewtalk().
User::checkPassword | ( | $password | ) |
User::checkPasswordValidity | ( | $password | ) |
Check if this is a valid password for this user.
Status will be good if the password is valid, or have an array of error messages if not.
string | $password | Desired password |
Definition at line 729 of file User.php.
References $password, $wgContLang, array(), getName(), global, Status\newGood(), and wfRunHooks().
Referenced by getPasswordValidity(), and UserTest\testCheckPasswordValidity().
User::checkTemporaryPassword | ( | $plaintext | ) |
User::clearAllNotifications | ( | ) |
Resets all of the given user's page-change notification timestamps.
If e-notif e-mails are on, they will receive notification mails on the next change of any watched page.
Definition at line 3221 of file User.php.
References $wgUseEnotif, array(), DB_MASTER, getId(), global, isAllowed(), setNewtalk(), wfGetDB(), and wfReadOnly().
|
protected |
Clear a cookie on the user's client.
string | $name | Name of the cookie to clear |
bool | $secure | true: Force setting the secure attribute when setting the cookie false: Force NOT setting the secure attribute when setting the cookie null (default): Use the default ($wgCookieSecure) to set the secure attribute |
array | $params | Array of options sent passed to WebResponse::setcookie() |
Definition at line 3276 of file User.php.
References $name, $params, and setCookie().
Referenced by doLogout(), and setCookies().
User::clearInstanceCache | ( | $reloadFrom = false | ) |
Clear various cached data stored in this object.
The cache of the user table data (i.e. self::$mCacheVars) is not cleared unless $reloadFrom is given.
bool | string | $reloadFrom | Reload user and user_groups table data from a given source. May be "name", "id", "defaults", "session", or false for no reload. |
Definition at line 1325 of file User.php.
References array().
Referenced by __construct(), addToDatabase(), doLogout(), setId(), and UserTest\testEditCount().
User::clearNotification | ( | & | $title, |
$oldid = 0 |
|||
) |
Clear the user's notification timestamp for the given title.
If e-notif e-mails are on, they will receive notification mails on the next change of the page if it's watched etc.
$title | Title of the article to look at | |
int | $oldid | The revision id being viewed. If not given or 0, latest revision is assumed. |
Definition at line 3160 of file User.php.
References $title, $wgUseEnotif, array(), getName(), getNewtalk(), getWatchedItem(), global, isAllowed(), isAnon(), Revision\newFromId(), NS_USER_TALK, setNewtalk(), wfReadOnly(), and wfRunHooks().
|
private |
Clear user data from memcached.
Use after applying fun updates to the database; caller's responsibility to update user_touched if appropriate.
Called implicitly from invalidateCache() and saveSettings().
Definition at line 2131 of file User.php.
References $wgMemc, global, load(), and wfMemcKey().
Referenced by invalidateCache(), and saveSettings().
|
static |
Compare a password hash with a plain-text password.
Requires the user ID if there's a chance that the hash is an old-style hash.
string | $hash | Password hash |
string | $password | Plain-text password to compare |
string | bool | $userId | User ID for old-style password salt |
Definition at line 4552 of file User.php.
References $hash, $password, $type, array(), list, oldCrypt(), and wfRunHooks().
|
protected |
A comparison of two strings, not vulnerable to timing attacks.
string | $answer | the secret string that you are comparing against. |
string | $test | compare this string to the $answer. |
Definition at line 1115 of file User.php.
References $test.
Referenced by loadFromSession().
|
protected |
Generate, store, and return a new e-mail confirmation code.
A hash (unsalted, since it's used as a key) is stored.
&$expiration | \mixed Accepts the expiration time |
Definition at line 3893 of file User.php.
References $hash, MWCryptRand\generateHex(), global, load(), TS_MW, and wfTimestamp().
Referenced by sendConfirmationMail().
|
protected |
Return a URL the user can use to confirm their email address.
string | $token | Accepts the email confirmation token |
Definition at line 3911 of file User.php.
References getTokenUrl().
Referenced by sendConfirmationMail().
User::confirmEmail | ( | ) |
Mark the e-mail address confirmed.
Definition at line 3951 of file User.php.
References array(), isEmailConfirmed(), setEmailAuthenticationTimestamp(), wfRunHooks(), and wfTimestampNow().
|
static |
Add a user to the database, return the user object.
string | $name | Username to add |
array | $params | of Strings Non-default parameters to save to the database as user_* fields:
|
Definition at line 3458 of file User.php.
References $name, $params, $user, $value, array(), as, DB_MASTER, newFromId(), User, and wfGetDB().
Referenced by UserWrapper\__construct(), TestUser\__construct(), TitlePermissionTest\setUp(), and RevisionStorageTest\testUserWasLastToEdit().
|
static |
Make a new-style password hash.
string | $password | Plain-text password |
bool | string | $salt | Optional salt, may be random or the user ID. If unspecified or false, will generate one automatically |
Definition at line 4524 of file User.php.
References $hash, $password, array(), MWCryptRand\generateHex(), global, and wfRunHooks().
Referenced by setInternalPassword(), and setNewpassword().
|
protected |
Clear the new messages flag for the given user.
string | $field | 'user_ip' for anonymous users, 'user_id' otherwise |
string | int | $id | User's IP address for anonymous users, User ID otherwise |
Definition at line 2061 of file User.php.
References array(), DB_MASTER, wfDebug(), and wfGetDB().
Referenced by setNewtalk().
User::doLogout | ( | ) |
Clear the user's cookies and session, and reset the instance cache.
Definition at line 3364 of file User.php.
References array(), clearCookie(), clearInstanceCache(), getRequest(), and setCookie().
Referenced by logout().
|
static |
Count the number of edits of a user.
int | $uid | User ID to check |
Definition at line 939 of file User.php.
References $user, newFromId(), and wfDeprecated().
User::editToken | ( | $salt = '' , |
|
$request = null |
|||
) |
Alias for getEditToken.
string | array | $salt | of Strings Optional function-specific data for hashing |
$request | WebRequest object to use or null to use $wgRequest |
Definition at line 3745 of file User.php.
References getEditToken(), and wfDeprecated().
User::expirePassword | ( | $ts = 0 | ) |
Expire a user's password.
$ts | Mixed: optional timestamp to convert, default 0 for the current time |
Definition at line 776 of file User.php.
References $timestamp, load(), saveSettings(), TS_MW, and wfTimestamp().
Referenced by UserTest\testPasswordExpire().
|
static |
Generate a looking random token for various uses.
Definition at line 3788 of file User.php.
References MWCryptRand\generateHex().
|
static |
Return the set of defined explicit groups.
The implicit groups (by default *, 'user' and 'autoconfirmed') are not included, as they are defined automatically, not in the database.
Definition at line 4221 of file User.php.
References global.
Referenced by UsersPager\__construct(), changeableByGroup(), changeableGroups(), ApiQueryAllUsers\execute(), UsersPager\getAllGroups(), UserrightsPage\getAllGroups(), ApiUserrights\getAllowedParams(), ApiQueryContributors\getAllowedParams(), and ApiQueryAllUsers\getAllowedParams().
|
static |
Get a list of all available permissions.
Definition at line 4233 of file User.php.
References $mAllRights, $mCoreRights, array(), global, and wfRunHooks().
Referenced by ApiQueryContributors\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), and UserTest\testAllRightsWithMessage().
User::getAutomaticGroups | ( | $recache = false | ) |
Get the list of implicit group memberships this user has.
This includes 'user' if logged in, '*' for all accounts, and autopromoted groups
bool | $recache | Whether to avoid the cache |
Definition at line 2834 of file User.php.
References $mImplicitGroups, array(), Autopromote\getAutopromoteGroups(), getId(), wfProfileIn(), and wfProfileOut().
Referenced by getEffectiveGroups().
User::getBlock | ( | $bFromSlave = true | ) |
Get the block affecting the user, or null if the user is not blocked.
bool | $bFromSlave | Whether to check the slave database instead of the master |
Definition at line 1731 of file User.php.
References getBlockedStatus().
Referenced by isBlocked().
|
private |
Get blocking information.
bool | $bFromSlave | Whether to check the slave database first. To improve performance, non-critical checks are done against slaves. Check when actually saving should be done against master. |
Definition at line 1399 of file User.php.
References $wgUser, array(), Block\chooseBlock(), Block\getBlocksForIPList(), getRequest(), global, isAllowed(), isAnon(), isDnsBlacklisted(), load(), Block\newFromTarget(), Block\setBlocker(), text, wfDebug(), wfMessage(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by blockedBy(), blockedFor(), getBlock(), getBlockId(), isBlockedFromCreateAccount(), isBlockedFromEmailuser(), and isHidden().
User::getBlockId | ( | ) |
If user is blocked, return the ID for the block.
Definition at line 1784 of file User.php.
References false, and getBlockedStatus().
User::getBoolOption | ( | $oname | ) |
Get the user's current setting for a given option, as a boolean value.
string | $oname | The option to check |
Definition at line 2477 of file User.php.
References getOption().
Referenced by requiresHTTPS().
|
static |
Given unvalidated user input, return a canonical username, or false if the username is invalid.
string | $name | User input |
string | bool | $validate | type of validation to use:
|
MWException |
Definition at line 883 of file User.php.
References $name, $t, $wgContLang, global, isCreatableName(), isUsableName(), isValidUserName(), Title\makeTitle(), Title\newFromText(), and NS_USER.
Referenced by RollbackEdits\execute(), UserrightsPage\execute(), ApiQueryUsers\execute(), UserrightsPage\fetchUser(), ApiRollback\getRbUser(), newFromName(), ApiQueryContributions\prepareUsername(), and ApiQueryBlocks\prepareUsername().
User::getDatePreference | ( | ) |
Get the user's preferred date format.
Definition at line 2729 of file User.php.
References $mDatePreference, $value, $wgLang, getOption(), and global.
Referenced by Language\getHumanTimestamp().
|
static |
Get a given default option value.
string | $opt | Name of option to retrieve |
Definition at line 1383 of file User.php.
References getDefaultOptions().
Referenced by ConvertUserOptions\convertOptionBatch(), Language\dateFormat(), CoreParserFunctions\gender(), GenderCache\getDefault(), ImagePage\getImageLimitsFromOption(), getOption(), getOptions(), Linker\makeImageLink(), saveOptions(), and setOption().
|
static |
Combine the language default options with any site-specific options and add the default language variants.
Definition at line 1350 of file User.php.
References $wgContLang, array(), as, global, SearchEngine\searchableNamespaces(), and wfRunHooks().
Referenced by getDefaultOption(), UserOptions\getDefaultOptionsNames(), Preferences\getPreferences(), UserOptions\LISTER(), loadOptions(), resetOptions(), and UserOptions\USAGER().
User::getEditCount | ( | ) |
Get the user's edit count.
Definition at line 2884 of file User.php.
References $count, $dbr, $mEditCount, array(), DB_SLAVE, getId(), initEditCount(), wfGetDB(), wfProfileIn(), and wfProfileOut().
Referenced by loadFromDatabase(), and UserTest\testEditCount().
User::getEditToken | ( | $salt = '' , |
|
$request = null |
|||
) |
Initialize (if necessary) and return a session token value which can be used in edit forms to show that the user's login credentials aren't being hijacked with a foreign form submission.
string | array | $salt | of Strings Optional function-specific data for hashing |
$request | WebRequest object to use or null to use $wgRequest |
Definition at line 3762 of file User.php.
References EDIT_TOKEN_SUFFIX, MWCryptRand\generateHex(), getRequest(), and isAnon().
Referenced by editToken(), matchEditToken(), and matchEditTokenNoSuffix().
User::getEffectiveGroups | ( | $recache = false | ) |
Get the list of implicit group memberships this user has.
This includes all explicit groups, plus 'user' if logged in, '*' for all accounts, and autopromoted groups
bool | $recache | Whether to avoid the cache |
Definition at line 2811 of file User.php.
References $mEffectiveGroups, array(), getAutomaticGroups(), getGroups(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by addGroup(), changeableGroups(), getRights(), and removeGroup().
User::getEmail | ( | ) |
Get the user's e-mail address.
Definition at line 2328 of file User.php.
References $mEmail, array(), load(), and wfRunHooks().
Referenced by SpecialPasswordReset\onSubmit(), and setEmailWithConfirmation().
User::getEmailAuthenticationTimestamp | ( | ) |
Get the timestamp of the user's e-mail authentication.
Definition at line 2338 of file User.php.
References $mEmailAuthenticated, array(), load(), and wfRunHooks().
Referenced by isEmailConfirmed().
User::getFirstEditTimestamp | ( | ) |
User::getFormerGroups | ( | ) |
Returns the groups the user has belonged to.
The user may still belong to the returned groups. Compare with getGroups().
The function will not return groups the user had belonged to before MW 1.17
Definition at line 2865 of file User.php.
References $dbr, $mFormerGroups, $res, array(), as, DB_MASTER, and wfGetDB().
|
static |
Get the localized descriptive name for a member of a group, if it exists.
string | $group | Internal group name |
string | $username | Username for gender (since 1.19) |
Definition at line 4210 of file User.php.
References wfMessage().
Referenced by UsersPager\buildGroupLink(), UserrightsPage\buildGroupMemberLink(), RightsLogFormatter\getMessageParameters(), UserrightsPage\groupCheckboxes(), and Preferences\profilePreferences().
|
static |
Get the localized descriptive name for a group, if it exists.
string | $group | Internal group name |
Definition at line 4198 of file User.php.
References wfMessage().
Referenced by UserrightsPage\buildGroupLink(), UsersPager\getAllGroups(), makeGroupLinkHTML(), makeGroupLinkWiki(), and Preferences\profilePreferences().
|
static |
Get the title of a page describing a particular group.
string | $group | Internal group name |
Definition at line 4263 of file User.php.
References $title, Title\newFromText(), and wfMessage().
Referenced by makeGroupLinkHTML(), and makeGroupLinkWiki().
|
static |
Get the permissions associated with a given list of groups.
array | $groups | of Strings List of internal group names |
Definition at line 4096 of file User.php.
References array(), as, and global.
Referenced by Autopromote\checkCondition(), ApiQueryAllUsers\execute(), getRights(), UserTest\testGroupPermissions(), UserTest\testRevokePermissions(), and wfStreamThumb().
User::getGroups | ( | ) |
Get the list of explicit group memberships this user has.
The implicit * and user groups are not included.
Definition at line 2798 of file User.php.
References $mGroups, load(), and loadGroups().
Referenced by addAutopromoteOnceGroups(), getEffectiveGroups(), and pingLimiter().
|
static |
Get all the groups who have a given permission.
string | $role | Role to check |
Definition at line 4123 of file User.php.
References array(), as, and global.
Referenced by PermissionsError\__construct(), ApiQueryAllUsers\execute(), ApiQueryContributors\execute(), NewFilesPager\getQueryInfo(), MWNamespace\getRestrictionLevels(), ContribsPager\getUserCond(), Title\missingPermissionError(), newFatalPermissionDeniedStatus(), ApiMain\reallyMakeHelpMsg(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), ApiQueryAllImages\run(), and UserTest\testGetGroupsWithPermission().
User::getId | ( | ) |
Get the user's ID.
Definition at line 1852 of file User.php.
References $mId, isIP(), isItemLoaded(), and load().
Referenced by addAutopromoteOnceGroups(), addGroup(), addNewUserLogEntry(), EmailNotification\canSendUserTalkEmail(), checkTemporaryPassword(), SpecialBlock\checkUnblockSelf(), clearAllNotifications(), ApiUnblock\execute(), ApiBlock\execute(), getAutomaticGroups(), Block\getBy(), getEditCount(), getFirstEditTimestamp(), SpecialEmailUser\getTarget(), incEditCount(), initEditCount(), loadOptions(), pingLimiter(), saveOptions(), and setNewtalk().
|
static |
Get a list of implicit groups.
Definition at line 4250 of file User.php.
References array(), global, and wfRunHooks().
Referenced by UsersPager\getGroups().
User::getIntOption | ( | $oname, | |
$defaultOverride = 0 |
|||
) |
Get the user's current setting for a given option, as an integer value.
string | $oname | The option to check |
int | $defaultOverride | A default value returned if the option does not exist |
Definition at line 2489 of file User.php.
References getOption().
Referenced by getStubThreshold().
User::getName | ( | ) |
Get the user name, or the IP of an anonymous user.
Definition at line 1876 of file User.php.
References $mName, getRequest(), isItemLoaded(), load(), and IP\sanitizeIP().
Referenced by __toString(), EmailNotification\actuallyNotifyOnPageChange(), addNewUserLogEntry(), checkPasswordValidity(), SpecialBlock\checkUnblockSelf(), clearNotification(), ApiUnblock\execute(), Block\getByName(), getNewMessageLinks(), getNewtalk(), getTitleKey(), getUserPage(), idForName(), isBlockedFrom(), isBlockedGlobally(), EmailNotification\notifyOnPageChange(), SpecialPasswordReset\onSubmit(), Block\parseTarget(), pingLimiter(), sendConfirmationMail(), setCookies(), setNewtalk(), spreadBlock(), and CreditsAction\userLink().
User::getNewMessageLinks | ( | ) |
Return the data needed to construct links for new talk page message alerts.
If there are new messages, this will return an associative array with the following data: wiki: The database name of the wiki link: Root-relative link to the user's talk page rev: The last talk page revision that the user has seen or null. This is useful for building diff links. If there are no new messages, it returns an empty array.
Definition at line 1968 of file User.php.
References $dbr, $rev, $timestamp, array(), DB_SLAVE, getName(), getNewtalk(), getTalkPage(), isAnon(), Revision\loadFromTimestamp(), wfGetDB(), wfRunHooks(), and wfWikiID().
Referenced by getNewMessageRevisionId().
User::getNewMessageRevisionId | ( | ) |
Get the revision ID for the last talk page revision viewed by the talk page owner.
Definition at line 1991 of file User.php.
References getNewMessageLinks(), and wfWikiID().
User::getNewtalk | ( | ) |
Check if the user has new messages.
Definition at line 1920 of file User.php.
References $mNewtalk, $wgMemc, checkNewtalk(), getName(), global, load(), page, and wfMemcKey().
Referenced by clearNotification(), and getNewMessageLinks().
User::getOption | ( | $oname, | |
$defaultOverride = null , |
|||
$ignoreHidden = false |
|||
) |
Get the user's current setting for a given option.
string | $oname | The option to check |
string | $defaultOverride | A default value returned if the option does not exist |
bool | $ignoreHidden | Whether to ignore the effects of $wgHiddenPrefs |
Reimplemented in PPFuzzUser.
Definition at line 2425 of file User.php.
References getDefaultOption(), global, and loadOptions().
Referenced by canReceiveEmail(), getBoolOption(), getDatePreference(), getIntOption(), RequestContext\getLanguage(), getTokenFromOption(), SpecialPasswordReset\onSubmit(), and UserTest\testOptions().
User::getOptionKinds | ( | IContextSource | $context, |
$options = null |
|||
) |
Return an associative array mapping preferences keys to the kind of a preference they're used for.
Different kinds are handled differently when setting or reading preferences.
See User::listOptionKinds for the list of valid option types that can be provided.
$context | IContextSource | |
array | $options | assoc. array with options keys to check as keys. Defaults to $this->mOptions. |
Definition at line 2602 of file User.php.
References $columns, $mOptions, $name, $options, $value, array(), as, HTMLFormField\flattenOptions(), Preferences\getPreferences(), Preferences\getSaveBlacklist(), and loadOptions().
Referenced by resetOptions().
User::getOptions | ( | ) |
Get all user's options.
Definition at line 2450 of file User.php.
References $mOptions, $options, as, getDefaultOption(), global, and loadOptions().
User::getPasswordExpired | ( | ) |
Check if the user's password is expired.
TODO: Put this and password length into a PasswordPolicy object
Definition at line 814 of file User.php.
References getPasswordExpireDate(), global, TS_UNIX, and wfTimestamp().
Referenced by UserTest\testPasswordExpire().
User::getPasswordExpireDate | ( | ) |
Get this user's password expiration date.
Since this may be using the cached User object, we assume that whatever mechanism is setting the expiration date is also expiring the User cache.
Definition at line 833 of file User.php.
References $mPasswordExpires, and load().
Referenced by getPasswordExpired().
User::getPasswordValidity | ( | $password | ) |
Given unvalidated password input, return error message on failure.
string | $password | Desired password |
Definition at line 702 of file User.php.
References $error, $messages, $password, array(), as, and checkPasswordValidity().
Referenced by isValidPassword(), setPassword(), and UserTest\testCheckPasswordValidity().
User::getRealName | ( | ) |
Get the user's real name.
Definition at line 2398 of file User.php.
References $mRealName, isItemLoaded(), and load().
User::getRegistration | ( | ) |
Get the timestamp of account creation.
Definition at line 4060 of file User.php.
References $mRegistration, isAnon(), and load().
User::getRequest | ( | ) |
Get the WebRequest object to use with this object.
Definition at line 3072 of file User.php.
References $mRequest, and global.
Referenced by doLogout(), getBlockedStatus(), getEditToken(), getName(), isBlockedFromCreateAccount(), isBlockedGlobally(), isPingLimitable(), loadDefaults(), loadFromSession(), pingLimiter(), requiresHTTPS(), sendConfirmationMail(), setCookie(), setCookies(), and spreadBlock().
|
static |
Get the description of a given right.
string | $right | Right to query |
Definition at line 4494 of file User.php.
References $right, and wfMessage().
Referenced by SpecialListGroupRights\formatPermissions(), and SpecialListGroupRights\outputNamespaceProtectionInfo().
User::getRights | ( | ) |
Get the permissions this user has.
Definition at line 2783 of file User.php.
References $mRights, array(), getEffectiveGroups(), getGroupPermissions(), and wfRunHooks().
Referenced by isAllowed().
User::getSkin | ( | ) |
Get the current skin, loading it if required.
Definition at line 3087 of file User.php.
References RequestContext\getMain(), and wfDeprecated().
User::getStubThreshold | ( | ) |
User::getTalkPage | ( | ) |
Get this user's talk page title.
Definition at line 3663 of file User.php.
References $title, and getUserPage().
Referenced by getNewMessageLinks().
User::getTitleKey | ( | ) |
User::getToken | ( | $forceCreation = true | ) |
Get the user's current token.
bool | $forceCreation | Force the generation of a new token if the user doesn't have one (default=true for backwards compatibility) |
Definition at line 2265 of file User.php.
References $mToken, load(), and setToken().
User::getTokenFromOption | ( | $oname | ) |
Get a token stored in the preferences (like the watchlist one), resetting it if it's empty (and saving changes).
string | $oname | The option name to retrieve the token from |
Definition at line 2523 of file User.php.
References getOption(), global, resetTokenFromOption(), and saveSettings().
|
protected |
Internal function to format the e-mail validation/invalidation URLs.
This uses a quickie hack to use the hardcoded English names of the Special: pages, for ASCII safety.
string | $page | Special page |
string | $token | Token |
Definition at line 3938 of file User.php.
References $title, Title\makeTitle(), and NS_MAIN.
Referenced by confirmationTokenUrl(), and invalidationTokenUrl().
User::getTouched | ( | ) |
User::getUserPage | ( | ) |
Get this user's personal page title.
Definition at line 3654 of file User.php.
References getName(), Title\makeTitle(), and NS_USER.
Referenced by addAutopromoteOnceGroups(), addNewUserLogEntry(), Block\getPermissionsError(), getTalkPage(), and saveSettings().
User::getWatchedItem | ( | $title, | |
$checkRights = WatchedItem::CHECK_USER_RIGHTS |
|||
) |
Get a WatchedItem for this user and $title.
$title | Title |
$checkRights | int Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS. |
Definition at line 3101 of file User.php.
References $title, array(), and WatchedItem\fromUserTitle().
Referenced by addWatch(), clearNotification(), isWatched(), and removeWatch().
|
static |
Check, if the given group has the given permission.
If you're wanting to check whether all users have a permission, use User::isEveryoneAllowed() instead. That properly checks if it's revoked from anyone.
string | $group | Group to check |
string | $role | Role to check |
Definition at line 4146 of file User.php.
References global.
Referenced by Title\checkQuickPermissions(), SpecialNewpages\filterLinks(), NewPagesPager\getQueryInfo(), SpecialPage\isRestricted(), and OutputPage\showPermissionsErrorPage().
User::idForName | ( | ) |
|
static |
Get database id given a user name.
string | $name | Username |
Definition at line 502 of file User.php.
References $dbr, $name, $s, array(), DB_SLAVE, Title\makeTitleSafe(), NS_USER, and wfGetDB().
Referenced by ApiQueryLogEvents\execute(), UsersPager\getQueryInfo(), LogPage\getTitleLink(), ContribsPager\getUserCond(), WikiRevision\importLogItem(), LogPager\limitPerformer(), load(), and SpecialUnblock\processUnblock().
User::incEditCount | ( | ) |
Increment the user's edit-count field.
Will have no effect for anonymous users.
Definition at line 4428 of file User.php.
References $dbr, array(), DB_MASTER, DB_SLAVE, getId(), initEditCount(), invalidateCache(), isAnon(), and wfGetDB().
Referenced by UserTest\testEditCount().
User::inDnsBlacklist | ( | $ip, | |
$bases | |||
) |
Whether the given IP is in a given DNS blacklist.
string | $ip | IP to check |
string | array | $bases | of Strings: URL of the DNS blacklist |
Definition at line 1514 of file User.php.
References array(), as, IP\isIPv4(), wfDebugLog(), wfProfileIn(), and wfProfileOut().
Referenced by isDnsBlacklisted().
|
protected |
Initialize user_editcount from data out of the revision table.
$add | Integer Edits to add to the count from the revision table |
Definition at line 4465 of file User.php.
References $count, $dbr, array(), DB_MASTER, DB_SLAVE, getId(), and wfGetDB().
Referenced by getEditCount(), and incEditCount().
User::invalidateCache | ( | ) |
Immediately touch the user data cache for this account.
Updates user_touched field, and removes account data from memcached for reload on the next hit.
Definition at line 2144 of file User.php.
References $mId, $mTouched, array(), clearSharedCache(), DB_MASTER, load(), newTouchedTimestamp(), wfGetDB(), and wfReadOnly().
Referenced by addGroup(), addWatch(), incEditCount(), removeGroup(), removeWatch(), and setNewtalk().
User::invalidateEmail | ( | ) |
Invalidate the user's e-mail confirmation, and unauthenticate the e-mail address if it was already confirmed.
Definition at line 3968 of file User.php.
References array(), load(), setEmailAuthenticationTimestamp(), and wfRunHooks().
Referenced by setEmail().
|
protected |
Return a URL the user can use to invalidate their email address.
string | $token | Accepts the email confirmation token |
Definition at line 3920 of file User.php.
References getTokenUrl().
Referenced by sendConfirmationMail().
User::isAllowed | ( | $action = '' | ) |
Internal mechanics of testing a permission.
string | $action |
Definition at line 3030 of file User.php.
References getRights(), and global.
Referenced by EmailNotification\actuallyNotifyOnPageChange(), canSendEmail(), changeableGroups(), SpecialBlock\checkUnblockSelf(), clearAllNotifications(), clearNotification(), WikiPage\commitRollback(), RecentChange\doMarkPatrolled(), getBlockedStatus(), isAllowedAll(), isAllowedAny(), isAllowedToCreateAccount(), isBlockedFromCreateAccount(), isNewbie(), isPingLimitable(), and EmailNotification\notifyOnPageChange().
User::isAllowedAll | ( | ) |
Is the input a valid password for this user?
string | $password | Desired password |
Definition at line 3015 of file User.php.
References as, and isAllowed().
User::isAllowedAny | ( | ) |
Check if user is allowed to access a feature / make an action.
Definition at line 3000 of file User.php.
References as, and isAllowed().
Referenced by WikiPage\commitRollback(), useNPPatrol(), and useRCPatrol().
User::isAllowedToCreateAccount | ( | ) |
Get whether the user is allowed to create an account.
Definition at line 3645 of file User.php.
References isAllowed(), and isBlockedFromCreateAccount().
User::isAnon | ( | ) |
Get whether the user is anonymous.
Definition at line 2988 of file User.php.
References isLoggedIn().
Referenced by clearNotification(), getBlockedStatus(), getEditToken(), getNewMessageLinks(), getRegistration(), incEditCount(), isEmailConfirmed(), saveToCache(), and setNewtalk().
User::isBlocked | ( | $bFromSlave = true | ) |
Check if user is blocked.
bool | $bFromSlave | Whether to check the slave database instead of the master |
Definition at line 1721 of file User.php.
References getBlock().
Referenced by Action\checkCanExecute(), FormSpecialPage\checkExecutePermissions(), SpecialBlock\checkUnblockSelf(), isBlockedFrom(), and spreadAnyEditBlock().
User::isBlockedFrom | ( | $title, | |
$bFromSlave = false |
|||
) |
Check if user is blocked from editing a particular article.
Title | $title | Title to check |
bool | $bFromSlave | whether to check the slave database instead of the master |
Definition at line 1743 of file User.php.
References $allowUsertalk, $title, array(), false, getName(), global, isBlocked(), NS_USER_TALK, wfDebug(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
User::isBlockedFromCreateAccount | ( | ) |
Get whether the user is explicitly blocked from account creation.
Definition at line 3615 of file User.php.
References $mBlock, getBlockedStatus(), getRequest(), isAllowed(), Block\newFromTarget(), and Block\prevents().
Referenced by isAllowedToCreateAccount().
User::isBlockedFromEmailuser | ( | ) |
Get whether the user is blocked from using Special:Emailuser.
Definition at line 3636 of file User.php.
References getBlockedStatus().
User::isBlockedGlobally | ( | $ip = '' | ) |
Check if user is blocked on all wikis.
Do not use for actual edit permission checks! This is intended for quick UI checks.
string | $ip | IP address, uses current client if none given |
Definition at line 1797 of file User.php.
References $mBlockedGlobally, array(), getName(), getRequest(), IP\isIPAddress(), and wfRunHooks().
|
static |
Usernames which fail to pass this function will be blocked from new account registrations, but may be used internally either by batch processes or by user accounts which have already been created.
Additional blacklisting may be added here rather than in isValidUserName() to avoid disrupting existing accounts.
string | $name | to match |
Definition at line 660 of file User.php.
References $name, global, isUsableName(), and wfDebugLog().
Referenced by getCanonicalName().
User::isDnsBlacklisted | ( | $ip, | |
$checkWhitelist = false |
|||
) |
Whether the given IP is in a DNS blacklist.
string | $ip | IP to check |
bool | $checkWhitelist | whether to check the whitelist first |
Definition at line 1491 of file User.php.
References array(), global, and inDnsBlacklist().
Referenced by getBlockedStatus().
User::isEmailConfirmationPending | ( | ) |
Check whether there is an outstanding request for e-mail confirmation.
Definition at line 4045 of file User.php.
References global, isEmailConfirmed(), and wfTimestamp().
User::isEmailConfirmed | ( | ) |
Is this user's e-mail address valid-looking and confirmed within limits of the current site configuration?
Definition at line 4021 of file User.php.
References array(), getEmailAuthenticationTimestamp(), global, isAnon(), load(), Sanitizer\validateEmail(), and wfRunHooks().
Referenced by canReceiveEmail(), canSendEmail(), confirmEmail(), and isEmailConfirmationPending().
|
static |
Check if all users have the given permission.
string | $right | Right to check |
Definition at line 4159 of file User.php.
References $cache, $right, array(), as, global, and wfRunHooks().
Referenced by ApiMain\checkExecutePermissions(), Title\checkReadPermissions(), RawAction\onView(), AjaxDispatcher\performAction(), and ApiMain\setCacheMode().
User::isHidden | ( | ) |
Check if user account is hidden.
Definition at line 1834 of file User.php.
References $mHideName, getBlockedStatus(), global, and StubObject\unstub().
|
static |
Does the string match an anonymous IPv4 address?
This function exists for username validation, in order to reject usernames which are similar in form to IP addresses. Strings such as 300.300.300.300 will return true because it looks like an IP address, despite not being strictly valid.
We match "\d{1,3}\.\d{1,3}\.\d{1,3}\.xxx" as an anonymous IP address because the usemod software would "cloak" anonymous IP addresses like this, if we allowed accounts like this to be created new users could get the old edits of these anonymous users.
string | $name | Name to match |
Definition at line 554 of file User.php.
References $name, and IP\isIPv6().
Referenced by SpecialContributions\contributionsSub(), WikiPage\doEditUpdates(), RollbackEdits\execute(), getId(), SearchEngine\getNearMatchInternal(), ApiRollback\getRbUser(), Skin\getRelevantUser(), ReassignEdits\initialiseUser(), isValidUserName(), ApiQueryContributions\prepareUsername(), ApiQueryBlocks\prepareUsername(), and Article\showMissingArticle().
User::isItemLoaded | ( | $item, | |
$all = 'all' |
|||
) |
Return whether an item has been loaded.
string | $item | item to check. Current possibilities:
|
string | $all | 'all' to check if the whole object has been loaded or any other string to check if only the item is available (e.g. for optimisation) |
Definition at line 1015 of file User.php.
References true.
Referenced by getId(), getName(), and getRealName().
|
static |
Check if an IP address is in the local proxy list.
$ip | string |
Definition at line 1561 of file User.php.
References $ret, file, global, wfProfileIn(), and wfProfileOut().
User::isLocked | ( | ) |
Check if user account is locked.
Definition at line 1818 of file User.php.
References $mLocked, global, and StubObject\unstub().
User::isLoggedIn | ( | ) |
Get whether the user is logged in.
Definition at line 2980 of file User.php.
Referenced by isAnon(), and spreadAnyEditBlock().
User::isNewbie | ( | ) |
Determine whether the user is a newbie.
Newbies are either anonymous IPs, or the most recently created accounts.
Definition at line 3673 of file User.php.
References isAllowed().
Referenced by pingLimiter().
User::isPasswordReminderThrottled | ( | ) |
User::isPingLimitable | ( | ) |
Is this user subject to rate limiting?
Definition at line 1593 of file User.php.
References getRequest(), global, and isAllowed().
Referenced by pingLimiter().
|
static |
Usernames which fail to pass this function will be blocked from user login and new account registrations, but may be used internally by batch processes.
If an account already exists in this form, login will be blocked by a failure to pass this function.
string | $name | Name to match |
Definition at line 623 of file User.php.
References $name, array(), as, global, wfMessage(), and wfRunHooks().
Referenced by LoginForm\authenticateUserData(), ApiBlock\execute(), getCanonicalName(), and isCreatableName().
|
static |
Does a string look like an e-mail address?
This validates an email address using an HTML5 specification found at: http://www.whatwg.org/html/states-of-the-type-attribute.html#valid-e-mail-address Which as of 2011-01-24 says:
A valid e-mail address is a string that matches the ABNF production
1*( atext / "." ) "@" ldh-str *( "." ldh-str ) where atext is defined in RFC 5322 section 3.2.3, and ldh-str is defined in RFC 1034 section 3.5.
This function is an implementation of the specification as requested in bug 22449.
Client-side forms will use the same standard validation rules via JS or HTML 5 validation; additional restrictions can be enforced server-side by extensions via the 'isValidEmailAddr' hook.
Note that this validation doesn't 100% match RFC 2822, but is believed to be liberal enough for wide use. Some invalid addresses will still pass validation here.
string | $addr | E-mail address |
Definition at line 865 of file User.php.
References Sanitizer\validateEmail(), and wfDeprecated().
User::isValidPassword | ( | $password | ) |
Is the input a valid password for this user?
string | $password | Desired password |
Definition at line 690 of file User.php.
References $password, and getPasswordValidity().
Referenced by setPassword(), and UserTest\testCheckPasswordValidity().
|
static |
Is the input a valid username?
Checks if the input is a valid username, we don't want an empty string, an IP address, anything that contains slashes (would mess up subpages), is longer than the maximum allowed username size or doesn't begin with a capital letter.
string | $name | Name to match |
Definition at line 569 of file User.php.
References $name, $wgContLang, global, isIP(), Title\newFromText(), and wfDebugLog().
Referenced by GenderCache\doQuery(), CheckUsernames\execute(), and getCanonicalName().
User::isWatched | ( | $title, | |
$checkRights = WatchedItem::CHECK_USER_RIGHTS |
|||
) |
Check the watched status of an article.
$title | Title of the article to look at |
$checkRights | int Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS. |
Definition at line 3124 of file User.php.
References $title, and getWatchedItem().
|
static |
Return a list of the types of user options currently returned by User::getOptionKinds().
Currently, the option kinds are:
The API (and possibly others) use this function to determine the possible option types for validation purposes, so make sure to update this when a new option kind is added.
Definition at line 2580 of file User.php.
References array().
Referenced by ApiOptions\getAllowedParams().
User::load | ( | ) |
Load the user table data for this object from the source given by mFrom.
Reimplemented in PPFuzzUser.
Definition at line 269 of file User.php.
References array(), idFromName(), loadDefaults(), loadFromId(), loadFromSession(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by addToDatabase(), checkPassword(), checkTemporaryPassword(), clearSharedCache(), confirmationToken(), expirePassword(), getBlockedStatus(), getEmail(), getEmailAuthenticationTimestamp(), getGroups(), getId(), getName(), getNewtalk(), getPasswordExpireDate(), getRealName(), getRegistration(), getToken(), getTouched(), invalidateCache(), invalidateEmail(), isEmailConfirmed(), isPasswordReminderThrottled(), loadOptions(), removeGroup(), resetOptions(), resetPasswordExpiration(), saveSettings(), saveToCache(), setCookies(), setEmail(), setEmailAuthenticationTimestamp(), setInternalPassword(), setName(), setNewpassword(), setNewtalk(), setRealName(), setToken(), spreadBlock(), and validateCache().
User::loadDefaults | ( | $name = false | ) |
Set cached properties to default.
$name | string|bool |
Definition at line 970 of file User.php.
References $name, array(), getRequest(), pages, resetPasswordExpiration(), TS_MW, wfProfileIn(), wfProfileOut(), wfRunHooks(), and wfTimestamp().
Referenced by PPFuzzUser\load(), load(), loadFromDatabase(), loadFromId(), UserTest\testEditCount(), and UserTest\testPasswordExpire().
User::loadFromDatabase | ( | ) |
Load user and user_group data from the database.
$this->mId must be set, this is how the user is identified.
Definition at line 1134 of file User.php.
References $dbr, $s, array(), DB_MASTER, getEditCount(), loadDefaults(), loadFromRow(), wfGetDB(), and wfRunHooks().
Referenced by addToDatabase(), and loadFromId().
User::loadFromId | ( | ) |
Load user table data, given mId has already been set.
Definition at line 312 of file User.php.
References $name, $wgMemc, as, global, loadDefaults(), loadFromDatabase(), MW_USER_VERSION, saveToCache(), wfDebug(), and wfMemcKey().
Referenced by load().
User::loadFromRow | ( | $row, | |
$data = null |
|||
) |
Initialize this object from a row from the user table.
stdClass | $row | Row from the user table to load. |
array | $data | Further user data to load into the object |
user_groups Array with groups out of the user_groups table user_properties Array with properties out of the user_properties table
Definition at line 1172 of file User.php.
References loadOptions(), setItemLoaded(), TS_MW, wfTimestamp(), and wfTimestampOrNull().
Referenced by loadFromDatabase().
|
private |
Load user data from the session or login cookie.
Definition at line 1035 of file User.php.
References $from, array(), compareSecrets(), getRequest(), global, loadFromUserObject(), newFromId(), wfDebug(), wfDebugLog(), and wfRunHooks().
Referenced by load().
|
protected |
|
private |
Load the groups from the database if they aren't already loaded.
Definition at line 1256 of file User.php.
References $dbr, $res, array(), as, DB_MASTER, and wfGetDB().
Referenced by addGroup(), getGroups(), removeGroup(), and saveToCache().
|
protected |
Load the user options either from cache, the database or an array.
array | $data | Rows for the current user out of the user_properties table |
Definition at line 4650 of file User.php.
References $dbr, $property, $res, $value, $wgContLang, array(), as, DB_SLAVE, getDefaultOptions(), getId(), global, load(), wfDebug(), wfGetDB(), and wfRunHooks().
Referenced by getOption(), getOptionKinds(), getOptions(), loadFromRow(), saveOptions(), saveToCache(), and setOption().
User::logout | ( | ) |
Log this user out.
Definition at line 3354 of file User.php.
References array(), doLogout(), and wfRunHooks().
|
static |
Create a link to the group in HTML, if available; else return the group name.
string | $group | Internal name of the group |
string | $text | The text of the link |
Definition at line 4282 of file User.php.
References $title, getGroupName(), getGroupPage(), and Linker\link().
Referenced by Preferences\profilePreferences().
|
static |
Create a link to the group in Wikitext, if available; else return the group name.
string | $group | Internal name of the group |
string | $text | The text of the link |
Definition at line 4302 of file User.php.
References $title, getGroupName(), and getGroupPage().
User::matchEditToken | ( | $val, | |
$salt = '' , |
|||
$request = null |
|||
) |
Check given value against the token value stored in the session.
A match should confirm that the form was submitted from the user's own login session, not a form submission from a third-party site.
string | $val | Input value to compare |
string | $salt | Optional function-specific data for hashing |
WebRequest | $request | Object to use or null to use $wgRequest |
Definition at line 3803 of file User.php.
References getEditToken(), and wfDebug().
User::matchEditTokenNoSuffix | ( | $val, | |
$salt = '' , |
|||
$request = null |
|||
) |
Check given value against the token value stored in the session, ignoring the suffix.
string | $val | Input value to compare |
string | $salt | Optional function-specific data for hashing |
WebRequest | $request | object to use or null to use $wgRequest |
Definition at line 3820 of file User.php.
References getEditToken().
|
static |
Factory function for fatal permission-denied errors.
string | $permission | User right required |
Definition at line 4854 of file User.php.
References $wgLang, array(), getGroupsWithPermission(), global, and Status\newFatal().
Referenced by WatchAction\doUnwatch(), and WatchAction\doWatch().
|
static |
Factory method to fetch whichever user has a given email confirmation code.
This code is generated when an account is created or its e-mail address has changed.
If the code is invalid or has expired, returns NULL.
string | $code | Confirmation code |
Definition at line 429 of file User.php.
References $dbr, array(), DB_SLAVE, newFromId(), and wfGetDB().
Referenced by EmailConfirmation\attemptConfirm(), and EmailInvalidation\attemptInvalidate().
|
static |
Static factory method for creation from a given user ID.
int | $id | Valid user ID |
Definition at line 411 of file User.php.
References User.
Referenced by Installer\__construct(), LogPage\addEntry(), UserOptions\CHANGER(), SpecialBlock\checkUnblockSelf(), createNew(), SpecialRedirect\dispatchUser(), edits(), MigrateUserGroup\execute(), RemoveUnusedAccounts\execute(), ChangePassword\execute(), ApiQueryAllUsers\execute(), NewFilesPager\formatRow(), ActiveUsersPager\formatRow(), UsersPager\getGroups(), NewUsersLogFormatter\getMessageParameters(), DatabaseLogEntry\getPerformer(), RCDatabaseLogEntry\getPerformer(), RequestContext\importScopedSession(), loadFromSession(), newFromConfirmationCode(), SpecialSearchTest\newUserWithSearchNS(), EnotifNotifyJob\run(), TitlePermissionTest\setUp(), Skin\showEmailUser(), LanguageConverterTest\testGetPreferredVariantHeaderUserVsUrl(), SpecialPageTest\testRequireLoginAnon(), ResetUserTokens\updateUser(), UserOptions\USAGER(), and Linker\userToolLinks().
|
static |
Static factory method for creation from username.
This is slightly less efficient than newFromId(), so use newFromId() if you have both an ID and a name handy.
string | $name | Username, validated by Title::newFromText() |
string | bool | $validate | Validate username. Takes the same parameters as User::getCanonicalName(), except that true is accepted as an alias for 'valid', for BC. |
Definition at line 388 of file User.php.
References $name, getCanonicalName(), and User.
Referenced by UserWrapper\__construct(), RecentChangeTest\__construct(), TestUser\__construct(), EmailNotification\actuallyNotifyOnPageChange(), MediaWikiTestCase\addCoreDBData(), GenderCacheTest\addDBData(), ApiBlockTest\addDBData(), BlockTest\addDBData(), BackupDumperLoggerTest\addDBData(), LoginForm\addNewAccountInternal(), BlockTest\addXffBlocks(), EditPageTest\assertEdit(), SpecialChangePassword\attemptReset(), LoginForm\authenticateUserData(), EmailNotification\canSendUserTalkEmail(), SpecialBlock\checkUnblockSelf(), Installer\createMainpage(), Installer\createSysop(), WikiPage\doEditUpdates(), Undelete\execute(), SpecialContributions\execute(), DeleteDefaultMessages\execute(), CleanupSpam\execute(), ApiBlock\execute(), ImportSiteScripts\execute(), ChangePassword\execute(), Protect\execute(), RollbackEdits\execute(), CapsCleanup\execute(), EditCLI\execute(), SpecialLog\execute(), CreateAndPromote\execute(), DeleteBatch\execute(), TableCleanup\execute(), MoveBatch\execute(), DeleteEqualMessages\execute(), DeletedContributionsPage\execute(), UserrightsPage\fetchUser(), LogFormatter\formatParameterValue(), CoreParserFunctions\gender(), CreditsAction\getAuthor(), WikiPage\getCreator(), LogEventsList\getExtraInputs(), NewUsersLogFormatter\getMessageParameters(), ResourceLoaderUserGroupsModule\getPages(), RecentChange\getPerformer(), DatabaseLogEntry\getPerformer(), RCDatabaseLogEntry\getPerformer(), Skin\getRelevantUser(), SpecialEmailUser\getTarget(), RCCacheEntryFactoryTest\getTestUser(), DoubleRedirectJob\getUser(), WikiRevision\importOldRevision(), RequestContext\importScopedSession(), WikiRevision\importUpload(), ReassignEdits\initialiseUser(), SearchEngineTest\insertPage(), RequestContext\newExtraneousContext(), WikiPage\onArticleDelete(), SpecialPasswordReset\onSubmit(), Block\parseTarget(), EnotifNotifyJob\run(), UploadFromUrlJob\run(), LogFormatterTest\setUp(), TitlePermissionTest\setUp(), SpecialLog\show(), Article\showMissingArticle(), BlockTest\testBlockedUserCanNotCreateAccount(), UserTest\testCheckPasswordValidity(), BlockTest\testCrappyCrossWikiBlocks(), UserTest\testEditCount(), RequestContextTest\testImportScopedSession(), ApiBlockTest\testMakeNormalBlock(), UserTest\testOptions(), UserTest\testPasswordExpire(), SpecialPageTest\testRequireLoginNotAnon(), GenderCacheTest\testUserObjects(), RevisionStorageTest\testUserWasLastToEdit(), and PageArchive\undeleteRevisions().
|
static |
Create a new user object from a user row.
The row should have the following fields from the user table in it:
stdClass | $row | A row from the user table |
array | $data | Further data to load into the object (see User::loadFromRow for valid keys) |
Definition at line 470 of file User.php.
Referenced by ApiQueryUsers\execute(), DatabaseLogEntry\getPerformer(), SpecialPasswordReset\onSubmit(), and UserArrayFromResult\setCurrent().
|
static |
Create a new user object using data from session or cookies.
If the login credentials are invalid, the result is an anonymous user.
WebRequest | $request | Object to use; $wgRequest will be used if omitted. |
Definition at line 449 of file User.php.
Referenced by RequestContext\getUser().
|
staticprivate |
Generate a current or new-future timestamp to be stored in the user_touched field when we update things.
Definition at line 2119 of file User.php.
References global, TS_MW, and wfTimestamp().
Referenced by addToDatabase(), invalidateCache(), and saveSettings().
|
static |
|
static |
Provide an array of HTML5 attributes to put on an input element intended for the user to enter a new password.
This may include required, title, and/or pattern, depending on $wgMinimalPasswordLength.
Do not use this when asking the user to enter his current password! Regardless of configuration, users may have invalid passwords for whatever reason (e.g., they were set before requirements were tightened up). Only use it when asking for a new password, like on account creation or ResetPass.
Obviously, you still need to do server-side checking.
NOTE: A combination of bugs in various browsers means that this function actually just returns array() unconditionally at the moment. May as well keep it around for when the browser bugs get fixed, though.
Definition at line 4787 of file User.php.
References $ret, array(), and global.
Referenced by UsercreateTemplate\execute().
User::pingLimiter | ( | $action = 'edit' , |
|
$incrBy = 1 |
|||
) |
Primitive rate limits: enforce maximum actions per time period to put a brake on flooding.
string | $action | Action to enforce; 'edit' if unspecified |
integer | $incrBy | Positive amount to increment counter by [defaults to 1] |
Definition at line 1615 of file User.php.
References $count, $incrBy, $keys, $limit, $matches, $summary, $wgMemc, array(), as, getGroups(), getId(), getName(), getRequest(), global, IP\isIPv6(), isNewbie(), isPingLimitable(), list, IP\parseRange(), wfDebug(), wfDebugLog(), wfMemcKey(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
|
static |
Return a random password.
Definition at line 950 of file User.php.
References MWCryptRand\generateHex(), global, and wfBaseConvert().
Referenced by TestUser\__construct(), and ApiCreateAccountTest\testValid().
User::removeGroup | ( | $group | ) |
Remove the user from the given group.
This takes immediate effect.
string | $group | Name of the group to remove |
Definition at line 2947 of file User.php.
References array(), DB_MASTER, getEffectiveGroups(), invalidateCache(), load(), loadGroups(), wfGetDB(), and wfRunHooks().
User::removeWatch | ( | $title, | |
$checkRights = WatchedItem::CHECK_USER_RIGHTS |
|||
) |
Stop watching an article.
$title | Title of the article to look at |
$checkRights | int Whether to check 'viewmywatchlist'/'editmywatchlist' rights. Pass WatchedItem::CHECK_USER_RIGHTS or WatchedItem::IGNORE_USER_RIGHTS. |
Definition at line 3147 of file User.php.
References $title, getWatchedItem(), and invalidateCache().
User::requiresHTTPS | ( | ) |
Determine based on the wiki configuration and the user's options, whether this user must be over HTTPS no matter what.
Definition at line 2749 of file User.php.
References array(), getBoolOption(), getRequest(), global, wfCanIPUseHTTPS(), and wfRunHooks().
Referenced by setCookies().
|
static |
Reset the cache used in idFromName().
For use in tests.
Definition at line 534 of file User.php.
References array().
Referenced by MediaWikiTestCase\addCoreDBData().
User::resetOptions | ( | $resetKinds = array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ) , |
|
IContextSource | $context = null |
||
) |
Reset certain (or all) options to the site defaults.
The optional parameter determines which kinds of preferences will be reset. Supported values are everything that can be reported by getOptionKinds() and 'all', which forces a reset of all preferences and overrides everything else.
array | string | $resetKinds | which kinds of preferences to reset. Defaults to array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ) for backwards-compatibility. |
$context | IContextSource|null context source used when $resetKinds does not contain 'all', passed to getOptionKinds(). Defaults to RequestContext::getMain() when null. |
Definition at line 2686 of file User.php.
References $defaultOptions, $value, array(), as, getDefaultOptions(), RequestContext\getMain(), getOptionKinds(), and load().
User::resetPasswordExpiration | ( | $load = true | ) |
Clear the password expiration for a user.
bool | $load | ensure user object is loaded first |
Definition at line 788 of file User.php.
References array(), global, load(), TS_MW, wfRunHooks(), and wfTimestamp().
Referenced by loadDefaults().
User::resetTokenFromOption | ( | $oname | ) |
Reset a token stored in the preferences (like the watchlist one).
Does not save user's preferences (similarly to setOption()).
string | $oname | The option name to reset the token in |
Definition at line 2546 of file User.php.
References MWCryptRand\generateHex(), global, and setOption().
Referenced by getTokenFromOption().
|
protected |
Definition at line 4712 of file User.php.
References $mOptions, $res, $value, array(), as, DB_MASTER, getDefaultOption(), getId(), loadOptions(), wfGetDB(), and wfRunHooks().
Referenced by addToDatabase(), and saveSettings().
User::saveSettings | ( | ) |
Save this user's settings into the database.
Definition at line 3381 of file User.php.
References $mEmail, $mEmailToken, $mRealName, array(), clearSharedCache(), DB_MASTER, getUserPage(), global, load(), newTouchedTimestamp(), saveOptions(), wfGetDB(), wfReadOnly(), and wfRunHooks().
Referenced by expirePassword(), getTokenFromOption(), sendConfirmationMail(), setCookies(), and UserTest\testOptions().
User::saveToCache | ( | ) |
Save user data to the shared cache.
Definition at line 351 of file User.php.
References $name, $wgMemc, array(), as, global, isAnon(), load(), loadGroups(), loadOptions(), MW_USER_VERSION, and wfMemcKey().
Referenced by loadFromId().
|
static |
Return the list of user fields that should be selected to create a new user object.
Definition at line 4827 of file User.php.
References array().
Referenced by ApiQueryUsers\execute(), UserArray\newFromIDs(), and SpecialPasswordReset\onSubmit().
User::sendConfirmationMail | ( | $type = 'created' | ) |
Generate a new e-mail confirmation token and send a confirmation/invalidation mail to the user's given address.
string | $type | message to send, either "created", "changed" or "set" |
Definition at line 3832 of file User.php.
References $type, $wgLang, confirmationToken(), confirmationTokenUrl(), getName(), getRequest(), global, invalidationTokenUrl(), saveSettings(), sendMail(), text, and wfMessage().
Referenced by setEmailWithConfirmation().
User::sendMail | ( | $subject, | |
$body, | |||
$from = null , |
|||
$replyto = null |
|||
) |
Send an e-mail to this user's account.
Does not check for confirmed status or validity.
string | $subject | Message subject |
string | $body | Message body |
string | $from | Optional From address; if unspecified, default $wgPasswordSender will be used |
string | $replyto | Reply-To address |
Definition at line 3870 of file User.php.
References $from, global, UserMailer\send(), text, and wfMessage().
Referenced by SpecialPasswordReset\onSubmit(), and sendConfirmationMail().
|
protected |
Set a cookie on the user's client.
Wrapper for WebResponse::setCookie
string | $name | Name of the cookie to set |
string | $value | Value to set |
int | $exp | Expiration time, as a UNIX time value; if 0 or not specified, use the default $wgCookieExpiration |
bool | $secure | true: Force setting the secure attribute when setting the cookie false: Force NOT setting the secure attribute when setting the cookie null (default): Use the default ($wgCookieSecure) to set the secure attribute |
array | $params | Array of options sent passed to WebResponse::setcookie() |
Definition at line 3262 of file User.php.
References $name, $params, $value, and getRequest().
Referenced by clearCookie(), doLogout(), and setCookies().
User::setCookies | ( | $request = null , |
|
$secure = null , |
|||
$rememberMe = false |
|||
) |
Set the default cookies for this session on the user's client.
$request | WebRequest object to use; $wgRequest will be used if null is passed. | |
bool | $secure | Whether to force secure/insecure cookies or use default |
bool | $rememberMe | Whether to add a Token cookie for elongated sessions |
Definition at line 3288 of file User.php.
References $cookies, $mToken, $name, $value, array(), as, clearCookie(), getName(), getRequest(), load(), requiresHTTPS(), saveSettings(), setCookie(), setToken(), and wfRunHooks().
User::setEmail | ( | $str | ) |
Set the user's e-mail address.
string | $str | New e-mail address |
Definition at line 2348 of file User.php.
References array(), invalidateEmail(), load(), and wfRunHooks().
Referenced by setEmailWithConfirmation().
User::setEmailAuthenticationTimestamp | ( | $timestamp | ) |
Set the e-mail authentication timestamp.
string | $timestamp | TS_MW timestamp |
Definition at line 3981 of file User.php.
References $timestamp, array(), load(), and wfRunHooks().
Referenced by confirmEmail(), and invalidateEmail().
User::setEmailWithConfirmation | ( | $str | ) |
Set the user's e-mail address and a confirmation mail if needed.
string | $str | New e-mail address |
Definition at line 2365 of file User.php.
References $type, getEmail(), global, Status\newFatal(), Status\newGood(), sendConfirmationMail(), and setEmail().
User::setId | ( | $v | ) |
Set the user and reload all fields according to a given ID.
int | $v | User ID to reload |
Definition at line 1867 of file User.php.
References clearInstanceCache().
User::setInternalPassword | ( | $str | ) |
Set the password and reset the random token unconditionally.
string | null | $str | New password to set or null to set an invalid password hash meaning that the user will not be able to log in through the web interface. |
Definition at line 2246 of file User.php.
References crypt(), load(), and setToken().
Referenced by setPassword().
|
protected |
Set that an item has been loaded.
string | $item |
Definition at line 1025 of file User.php.
Referenced by loadFromRow().
User::setName | ( | $str | ) |
Set the user name.
This does not reload fields from the database according to the given name. Rather, it is used to create a temporary "nonexistent user" for later addition to the database. It can also be used to set the IP address for an anonymous user to something other than the current remote IP.
string | $str | New user name to set |
Definition at line 1903 of file User.php.
References load().
User::setNewpassword | ( | $str, | |
$throttle = true |
|||
) |
Set the password for a password reminder or new account email.
$str | New password to set or null to set an invalid password hash meaning that the user will not be able to use it | |
bool | $throttle | If true, reset the throttle timestamp to the present |
Definition at line 2295 of file User.php.
References crypt(), load(), and wfTimestampNow().
User::setNewtalk | ( | $val, | |
$curRev = null |
|||
) |
Update the 'You have new messages!' status.
bool | $val | Whether the user has new messages |
$curRev | Revision new, as yet unseen revision of the user talk page. Ignored if null or !$val. |
Definition at line 2080 of file User.php.
References $changed, $wgMemc, deleteNewtalk(), getId(), getName(), global, invalidateCache(), isAnon(), load(), updateNewtalk(), wfMemcKey(), and wfReadOnly().
Referenced by clearAllNotifications(), and clearNotification().
User::setOption | ( | $oname, | |
$val | |||
) |
Set the given option for a user.
string | $oname | The option to set |
mixed | $val | New value to set |
Definition at line 2503 of file User.php.
References getDefaultOption(), and loadOptions().
Referenced by resetTokenFromOption(), and UserTest\testOptions().
User::setPassword | ( | $str | ) |
Set the password and reset the random token.
Calls through to authentication plugin if necessary; will have no effect if the auth plugin refuses to pass the change through or if the legal password checks fail.
As a special case, setting the password to null wipes it, so the account cannot be logged in until a new password is set, for instance via e-mail.
string | $str | New password to set |
PasswordError | on failure |
Definition at line 2208 of file User.php.
References $params, array(), getPasswordValidity(), global, isValidPassword(), setInternalPassword(), text, and wfMessage().
User::setRealName | ( | $str | ) |
User::setToken | ( | $token = false | ) |
Set the random token (used for persistent authentication) Called from loadDefaults() among other places.
string | bool | $token | If specified, set the token to this value |
Definition at line 2279 of file User.php.
References MWCryptRand\generateHex(), load(), and USER_TOKEN_LENGTH.
Referenced by addToDatabase(), getToken(), setCookies(), and setInternalPassword().
User::spreadAnyEditBlock | ( | ) |
If this user is logged-in and blocked, block any IP address they've successfully logged in from.
Definition at line 3584 of file User.php.
References isBlocked(), isLoggedIn(), and spreadBlock().
|
protected |
If this (non-anonymous) user is blocked, block the IP address they've successfully logged in from.
Definition at line 3596 of file User.php.
References getName(), getRequest(), load(), Block\newFromTarget(), and wfDebug().
Referenced by spreadAnyEditBlock().
|
protected |
Add or update the new messages flag.
string | $field | 'user_ip' for anonymous users, 'user_id' otherwise |
string | int | $id | User's IP address for anonymous users, User ID otherwise |
$curRev | Revision new, as yet unseen revision of the user talk page. Ignored if null. |
Definition at line 2036 of file User.php.
References array(), DB_MASTER, wfDebug(), and wfGetDB().
Referenced by setNewtalk().
User::useNPPatrol | ( | ) |
Check whether to enable new pages patrol features for this user.
Definition at line 3059 of file User.php.
References global, and isAllowedAny().
User::useRCPatrol | ( | ) |
Check whether to enable recent changes patrol features for this user.
Definition at line 3050 of file User.php.
References global, and isAllowedAny().
User::validateCache | ( | $timestamp | ) |
Validate the cache for this account.
string | $timestamp | A timestamp in TS_MW format |
Definition at line 2178 of file User.php.
References $timestamp, and load().
|
static |
Get the username corresponding to a given user ID.
int | $id | User ID |
Definition at line 483 of file User.php.
References UserCache\singleton().
Referenced by Title\checkActionPermissions(), UserrightsPage\fetchUser(), ImageListPager\formatValue(), and Revision\getRawUserText().
|
static |
Get the real name of a user given their user ID.
int | $id | User ID |
Definition at line 493 of file User.php.
References UserCache\singleton().
|
static |
bool User::$mAllowUsertalk |
|
static |
String Cached results of getAllRights()
Definition at line 181 of file User.php.
Referenced by getAllRights().
Block User::$mBlock |
Bool Whether the cache variables have been loaded.
Definition at line 229 of file User.php.
Referenced by isBlockedFromCreateAccount().
User::$mBlockedby |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by blockedBy().
User::$mBlockedGlobally |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by isBlockedGlobally().
User::$mBlockreason |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by blockedFor().
|
static |
Array of Strings List of member variables which are saved to the shared cache (memcached).
Any operation which changes the corresponding database fields must call a cache-clearing function.
|
static |
Array of Strings Core rights.
Each of these should have a corresponding message of the form "right-$right".
Definition at line 108 of file User.php.
Referenced by getAllRights().
User::$mDatePreference |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getDatePreference().
User::$mEditCount |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getEditCount().
User::$mEffectiveGroups |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getEffectiveGroups().
User::$mEmail |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by addToDatabase(), getEmail(), and saveSettings().
User::$mEmailAuthenticated |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getEmailAuthenticationTimestamp().
User::$mEmailToken |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by saveSettings().
User::$mEmailTokenExpires |
User::$mFormerGroups |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getFormerGroups().
User::$mFrom |
String Initialization data source if mLoadedItems!==true.
May be one of:
Use the User::newFrom*() family of functions to set this.
User::$mGroups |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getGroups().
User::$mHash |
User::$mHideName |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by isHidden().
User::$mId |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getId(), and invalidateCache().
User::$mImplicitGroups |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getAutomaticGroups().
|
private |
User::$mLocked |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by isLocked().
User::$mName |
User::$mNewpassTime |
User::$mNewpassword |
User::$mNewtalk |
Lazy-initialized variables, invalidated with clearInstanceCache.
Definition at line 219 of file User.php.
Referenced by getNewtalk().
User::$mOptionOverrides |
User::$mOptions |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getOptionKinds(), getOptions(), and saveOptions().
User::$mOptionsLoaded |
User::$mPassword |
|
protected |
Bool Whether the cache variables have been loaded.
Definition at line 190 of file User.php.
Referenced by getPasswordExpireDate().
User::$mRealName |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by addToDatabase(), getRealName(), and saveSettings().
User::$mRegistration |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getRegistration().
|
private |
Bool Whether the cache variables have been loaded.
Definition at line 225 of file User.php.
Referenced by getRequest().
User::$mRights |
Bool Whether the cache variables have been loaded.
Definition at line 219 of file User.php.
Referenced by getRights().
User::$mToken |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getToken(), and setCookies().
User::$mTouched |
Bool Whether the cache variables have been loaded.
Definition at line 185 of file User.php.
Referenced by getTouched(), and invalidateCache().
|
private |
const User::EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX |
Definition at line 66 of file User.php.
Referenced by ApiTestCase\doApiRequestWithToken(), and getEditToken().
const User::MAX_WATCHED_ITEMS_CACHE = 100 |
const User::MW_USER_VERSION = MW_USER_VERSION |
Definition at line 65 of file User.php.
Referenced by loadFromId(), and saveToCache().
const User::USER_TOKEN_LENGTH = USER_TOKEN_LENGTH |
Global constants made accessible as class constants so that autoloader magic can be used.
Definition at line 64 of file User.php.
Referenced by setToken().