手册:User.php
MediaWiki文件: User.php | |
---|---|
位置: | includes/user/ |
源代码: | master • 1.42.3 • 1.41.4 • 1.39.10 |
类: | MediaWiki\User\User |
描述
User.php implements the User class, which encapsulates all of the user-specific settings (user_id, name, rights, 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.
createAndPromote.php uses User::newFromName()
, User::addToDatabase()
, and User::saveSettings()
.
The User class used to contain password handling, but it was removed with the introduction of AuthManager.
Static factory methods
static newFromName ($name, $validate= 'valid')
static newFromId ($id)
static newFromConfirmationCode ($code)
static newFromSession (WebRequest $request=null)
static newFromRow ($row, $data=null)
其他方法
还有很多其他的。 参见https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1User_1_1User.html获取完整列表。
getId()
: Get the user's ID. Returns 0 if the user is anonymous or nonexistent.getName()
: Get the user name, or the IP of an anonymous user.getEmail()
: Get the user's email address.getGroups()
: Get the list of explicit group memberships this user has. (The implicit * and user groups are not included.)getRights()
: Get the permissions this user has.
参见
- 手册:$wgUser - global user object (deprecated)
- Manual:RequestContext.php - Used to get the User associated with a request.
- 手册:中心ID
- 手册:代码结构
- 手册:代码编写约定
- Category:MediaWiki hooks included in User.php