手册:user表

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:User table and the translation is 63% complete.

Outdated translations are marked like this.
Other languages:
English • ‎español • ‎français • ‎polski • ‎中文 • ‎日本語 • ‎한국어
手册:目录 MediaWiki数据库布局 user table/zh


user表是MediaWiki用來儲存用戶資訊的地方。 如果使用Postgres,這個表會被命名為mwuser

字段

有的信息从 MediaWiki docs/ 目录的 schema.doc 改写而来。

user_id

user_id是主鍵,用於唯一地辨識用戶。

user_name

user_name: 用戶名必須是獨一無二的,並且不能是IP地址的格式。 不應該允許斜線或大小寫衝突。 参见手册:$wgInvalidUsernameCharacters 。 允許空格,並下劃線會被轉換為空格(與頁面名稱相反)。

user_real_name

MediaWiki版本: 1.3

user_real_name儲存用戶在「偏好設定」中提供的真實姓名(選填)。

user_password

user_password使以下三種之一的格式,根據了$wgPasswordSalt $wgPasswordDefault 的設定:

  • 從MediaWiki 1.24開始,$wgPasswordDefault預設為pbkdf2。 这时你会得到以下各项的连接:
    • 字串「:pbkdf2:」。
    • pbkdf2层用的散列函数,默认是“sha256”。
    • 冒号(“:”)。
    • 算法的成本,默认“10000”。
    • 冒号(“:”)。
    • 子密钥长度;默认“128”。
    • 冒号(“:”)。
    • 散列算法的Base64编码的“盐”,例如“kkdejKlBYFV7+LP2m2thYA==”
    • 冒号(“:”)。
    • 最终是Base64编码的散列算法的结果(base64编码前(默认)长度是128字节) 用户密码明文的哈希值。
  • Since MediaWiki 1.24, if the maintenance script wrapOldPasswords.php has been used, passwords may also start with ":pbkdf2-legacyA:" or ":pbkdf2-legacyB:" like ":pbkdf2-legacyB:!sha256:10000:128!...".
  • In MediaWiki 1.23 and older, if $wgPasswordSalt is true (default) it is a concatenation of:
    • 字符串“:B:”,
    • A pseudo-random hexadecimal 31-bit salt between 0x0 and 0x7fff ffff (inclusive),
    • The colon character (":"), and
    • The MD5 hash of a concatenation of the salt, a dash ("-"), and the MD5 hash of the password.
  • In MediaWiki 1.23 and older, if $wgPasswordSalt is false, it is a concatenation of:
    • 字符串":A:" 和
    • 密码的MD5哈希值。

user_newpassword

user_newpassword is generated for the mail-a-new-password feature.

user_newpass_time

user_newpass_time is set to the current timestamp (wfTimestampNow()) when a new password is set. Like the other timestamps, it is in in MediaWiki's timestamp format (yyyymmddhhmmss, e.g. 20130824025644).

user_email

email should be restricted, not public info. 和密码相同。 ;)

Note that this field is not nullable, so users who have never supplied an email address have an empty string set.

user_options

MediaWiki版本: 1.18

user_options is no longer used as of MediaWiki 1.16. 参见手册:user_properties表

On older versions of mediawiki, it is a newline-separated list of name=value pairs of the information of Special:Preferences. Old user accounts who haven't logged in since the field stopped being used may still have this field set.

user_touched

user_touched the last time a user made a change on the site, including logins, changes to pages (any namespace), watchlistings, and preference changes.

The user_touched time resets when a user is left a talkpage message.

user_token

MediaWiki版本: 1.4

user_token是伪随机方法产生的值。 When a user checks "Remember my login on this browser" the value is stored in a persistent browser cookie ${wgCookiePrefix}Token that authenticates the user while being resistant to spoofing.

user_email_authenticated

user_email_authenticated是用户验证了电子邮箱的时间的时间戳。 默认是NULL

user_email_token

MediaWiki版本: 1.5

user_email_token是用于确认电子邮箱地址的令牌。 参见 User.php 中的 User::newFromConfirmationCode

user_email_token_expires

user_email_token_expires is the expiration timestamp of the email token.

user_registration

MediaWiki版本: 1.6

user_registration是用户注册时间的时间戳。 对于老用户,此域可能有NULL值。 fixUserRegistration.php 脚本可以用于事后填写此域。

user_editcount

MediaWiki版本: 1.9

user_editcount是用户大致的编辑次数和用户完成的像编辑一样的操作。 下列操作属于编辑:

  • Creating or modifying a MediaWiki page even if the revision or page is later deleted (i.e. making a non-null edit)
  • Creating or modifying a post on a Structured Discussions (former "Flow") board
  • Moving a page to a new title (since version 1.30)

This field is not an exactly accurate copy of COUNT(*) FROM revision WHERE rev_user = user_id. However, it should be roughly accurate if the update scripts are consistently run and it's the only place edit count data is available to the software, so it's still used for serious purposes like deciding whether accounts have been autopromoted.

有许多事情可以导致此值错误。 例如,它可能过时,或者对于老用户来说如果升级脚本(initEditCount.php )没有运行,就会是NULL。 而且,某些删除操作可能不会正确影响它。

user_emailauthenticationtimestamp

MediaWiki版本: 1.3

在v1.4版本中移除。

user_password_expires

MediaWiki版本: 1.23

Date when user's password expires; null for no expiration date. Can also be set manually by calling User->expirePassword().

模式摘要

MediaWiki版本: 1.23

DESCRIBE user;

+--------------------------+------------------+------+-----+----------------------------------+----------------+
| Field                    | Type             | Null | Key | Default                          | Extra          |
+--------------------------+------------------+------+-----+----------------------------------+----------------+
| user_id                  | int(10) unsigned | NO   | PRI | NULL                             | auto_increment |
| user_name                | varbinary(255)   | NO   | UNI |                                  |                |
| user_real_name           | varbinary(255)   | NO   |     |                                  |                |
| user_password            | tinyblob         | NO   |     | NULL                             |                |
| user_newpassword         | tinyblob         | NO   |     | NULL                             |                |
| user_newpass_time        | binary(14)       | YES  |     | NULL                             |                |
| user_email               | tinyblob         | NO   | MUL | NULL                             |                |
| user_touched             | binary(14)       | NO   |     |                                  |                |
| user_token               | binary(32)       | NO   |     |                                  |                |
| user_email_authenticated | binary(14)       | YES  |     | NULL                             |                |
| user_email_token         | binary(32)       | YES  | MUL | NULL                             |                |
| user_email_token_expires | binary(14)       | YES  |     | NULL                             |                |
| user_registration        | binary(14)       | YES  |     | NULL                             |                |
| user_editcount           | int(11)          | YES  |     | NULL                             |                |
| user_password_expires    | varbinary(14)    | YES  |     | NULL                             |                |
+--------------------------+------------------+------+-----+----------------------------------+----------------+
MediaWiki版本s: 1.19 – 1.22

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_newpass_time        | binary(14)          | YES  |     | NULL    |                |
| user_email               | tinytext            | NO   | MUL | NULL    |                |
| user_touched             | binary(14)          | NO   |     | NULL    |                |
| user_token               | binary(32)          | NO   |     | NULL    |                |
| user_email_authenticated | binary(14)          | YES  |     | NULL    |                |
| user_email_token         | binary(32)          | YES  | MUL | NULL    |                |
| user_email_token_expires | binary(14)          | YES  |     | NULL    |                |
| user_registration        | binary(14)          | YES  |     | NULL    |                |
| user_editcount           | int(11)             | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本: 1.18

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_newpass_time        | binary(14)          | YES  |     | NULL    |                |
| user_email               | tinytext            | NO   | MUL | NULL    |                |
| user_options             | blob                | NO   |     | NULL    |                |
| user_touched             | binary(14)          | NO   |     | NULL    |                |
| user_token               | binary(32)          | NO   |     | NULL    |                |
| user_email_authenticated | binary(14)          | YES  |     | NULL    |                |
| user_email_token         | binary(32)          | YES  | MUL | NULL    |                |
| user_email_token_expires | binary(14)          | YES  |     | NULL    |                |
| user_registration        | binary(14)          | YES  |     | NULL    |                |
| user_editcount           | int(11)             | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本s: 1.10 – 1.17

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_newpass_time        | binary(14)          | YES  |     | NULL    |                |
| user_email               | tinytext            | NO   |     | NULL    |                |
| user_options             | blob                | NO   |     | NULL    |                |
| user_touched             | binary(14)          | NO   |     | NULL    |                |
| user_token               | binary(32)          | NO   |     | NULL    |                |
| user_email_authenticated | binary(14)          | YES  |     | NULL    |                |
| user_email_token         | binary(32)          | YES  | MUL | NULL    |                |
| user_email_token_expires | binary(14)          | YES  |     | NULL    |                |
| user_registration        | binary(14)          | YES  |     | NULL    |                |
| user_editcount           | int(11)             | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本: 1.9

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_newpass_time        | char(14) binary     | YES  |     | NULL    |                |
| user_email               | tinytext            | NO   |     | NULL    |                |
| user_options             | blob                | NO   |     | NULL    |                |
| user_touched             | char(14) binary     | NO   |     | NULL    |                |
| user_token               | char(32) binary     | NO   |     | NULL    |                |
| user_email_authenticated | char(14) binary     | YES  |     | NULL    |                |
| user_email_token         | char(32) binary     | YES  | MUL | NULL    |                |
| user_email_token_expires | char(14) binary     | YES  |     | NULL    |                |
| user_registration        | char(14) binary     | YES  |     | NULL    |                |
| user_editcount           | int(11)             | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本s: 1.6 – 1.8

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_email               | tinytext            | NO   |     | NULL    |                |
| user_options             | blob                | NO   |     | NULL    |                |
| user_touched             | char(14) binary     | NO   |     | NULL    |                |
| user_token               | char(32) binary     | NO   |     | NULL    |                |
| user_email_authenticated | char(14) binary     | YES  |     | NULL    |                |
| user_email_token         | char(32) binary     | YES  | MUL | NULL    |                |
| user_email_token_expires | char(14) binary     | YES  |     | NULL    |                |
| user_registration        | char(14) binary     | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本: 1.5

DESCRIBE user;

+--------------------------+---------------------+------+-----+---------+----------------+
| Field                    | Type                | Null | Key | Default | Extra          |
+--------------------------+---------------------+------+-----+---------+----------------+
| user_id                  | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name                | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name           | varchar(255) binary | NO   |     | NULL    |                |
| user_password            | tinyblob            | NO   |     | NULL    |                |
| user_newpassword         | tinyblob            | NO   |     | NULL    |                |
| user_email               | tinytext            | NO   |     | NULL    |                |
| user_options             | blob                | NO   |     | NULL    |                |
| user_touched             | char(14) binary     | NO   |     | NULL    |                |
| user_token               | char(32) binary     | NO   |     | NULL    |                |
| user_email_authenticated | char(14) binary     | YES  |     | NULL    |                |
| user_email_token         | char(32) binary     | YES  | MUL | NULL    |                |
| user_email_token_expires | char(14) binary     | YES  |     | NULL    |                |
+--------------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本: 1.4

DESCRIBE user;

+------------------+---------------------+------+-----+---------+----------------+
| Field            | Type                | Null | Key | Default | Extra          |
+------------------+---------------------+------+-----+---------+----------------+
| user_id          | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name        | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name   | varchar(255) binary | NO   |     | NULL    |                |
| user_password    | tinyblob            | NO   |     | NULL    |                |
| user_newpassword | tinyblob            | NO   |     | NULL    |                |
| user_email       | tinytext            | NO   |     | NULL    |                |
| user_options     | blob                | NO   |     | NULL    |                |
| user_touched     | char(14) binary     | NO   |     | NULL    |                |
+------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本: 1.3

DESCRIBE user;

+------------------+---------------------+------+-----+---------+----------------+
| Field            | Type                | Null | Key | Default | Extra          |
+------------------+---------------------+------+-----+---------+----------------+
| user_id          | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name        | varchar(255) binary | NO   | MUL | NULL    |                |
| user_real_name   | varchar(255) binary | NO   |     | NULL    |                |
| user_rights      | tinyblob            | NO   |     | NULL    |                |
| user_password    | tinyblob            | NO   |     | NULL    |                |
| user_newpassword | tinyblob            | NO   |     | NULL    |                |
| user_email       | tinytext            | NO   |     | NULL    |                |
| user_options     | blob                | NO   |     | NULL    |                |
| user_touched     | char(14) binary     | NO   |     | NULL    |                |
+------------------+---------------------+------+-----+---------+----------------+
MediaWiki版本s: 1.1 – 1.2

DESCRIBE user;

+------------------+---------------------+------+-----+---------+----------------+
| Field            | Type                | Null | Key | Default | Extra          |
+------------------+---------------------+------+-----+---------+----------------+
| user_id          | int(5) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| user_name        | varchar(255) binary | NO   | MUL | NULL    |                |
| user_rights      | tinyblob            | NO   |     | NULL    |                |
| user_password    | tinyblob            | NO   |     | NULL    |                |
| user_newpassword | tinyblob            | NO   |     | NULL    |                |
| user_email       | tinytext            | NO   |     | NULL    |                |
| user_options     | blob                | NO   |     | NULL    |                |
| user_touched     | char(14) binary     | NO   |     | NULL    |                |
+------------------+---------------------+------+-----+---------+----------------+

参见