Nothing Special   »   [go: up one dir, main page]

Jump to content

手册:user表

From mediawiki.org
This page is a translated version of the page Manual:User table and the translation is 80% complete.
手册:索引 MediaWiki数据库布局 user表

user表是MediaWiki用來儲存用戶資訊的地方。 如果使用Postgres,在1.37版之前這個表會被命名為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是以下三種格式之一,取决于$wgPasswordDefault 的設定:

  • 從MediaWiki 1.24開始,$wgPasswordDefault預設為pbkdf2。 这时你会得到以下各项的连接:
    • 字串":pbkdf2:"。
    • pbkdf2层用的散列函数,默认是"sha512"。
    • 冒号(:)。
    • 算法的成本,默认"30000"。
    • 冒号(:)。
    • 子密钥长度;默认“64”。
    • 冒号(:)。
    • 散列算法的Base64编码的,例如"kkdejKlBYFV7+LP2m2thYA=="
    • 冒号(:)。
    • 最终是Base64编码的散列算法的结果(base64编码前(默认)长度是128字节) 用户密码明文的哈希值。
  • 自MediaWiki 1.24起,如果使用了維護腳本wrapOldPasswords.php ,密碼應以":pbkdf2-legacyA:"或":pbkdf2-legacyB:"為前綴,例如":pbkdf2-legacyB:!sha256:10000:128!..."。
  • 对于由MediaWiki 1.23或更早版本写入的密码,如果$wgPasswordSalt為true(預設),則是以下內容串聯:
    • 字符串":B:"
    • 偽隨機在0x0到0x7fff ffff(包含)之間的十六進位31位元
    • 冒號(:
    • 、破折號("-")和密碼MD5雜湊串聯後的MD5雜湊。
  • 对于由MediaWiki 1.23或更早版本写入的密码,如果$wgPasswordSalt為false,則是以下內容串聯:
    • 字符串":A:"
    • 密码的MD5哈希值。

user_newpassword

user_newpassword是通過電郵發送臨時密碼功能產生的值。

user_newpass_time

user_newpass_time在新密碼設定時被設為目前時間戳(wfTimestampNow())。 像是其他時間戳,這是以MediaWiki時間戳的格式(yyyymmddhhmmss,例如20130824025644)。

user_email

Email應被限制,非公開資訊。 和密码相同。 若輸入詳細資訊,後果自負。 ;)
这个字段不可为空(NULL),所以从未提交过电邮地址的用户此字段将会是一个空字符串。

user_options

MediaWiki版本:
1.18

自MediaWiki 1.16起user_options不再使用。 参见手册: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 logged in (not just mere visiting using an existing session), modified user settings, or got promoted into new user groups.

user_token

MediaWiki版本:
1.4

user_token是伪随机方法产生的值。 When a user checks "记住我的登录状态" 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)

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

使用者密碼逾期日期;無逾期日期為null。

user_is_temp

MediaWiki版本:
1.41
Gerrit change 918513

A boolean value representing whether the user is a temporary user. Zero if any type of user other than a temporary user. This exists to allow temporary users to be identified from the database only, by external applications.

模式摘要

MediaWiki版本:
1.41

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   |     | NULL                             |                |
| 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(10) unsigned | YES  |     | NULL                             |                |
| user_password_expires    | varbinary(14)    | YES  |     | NULL                             |                |
| user_is_temp             | tinyint(1)       | NO   |     | 0                                |                |
+--------------------------+------------------+------+-----+----------------------------------+----------------+
MediaWiki版本:
1.39 – 1.40

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   |     | NULL                             |                |
| 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(10) unsigned | YES  |     | NULL                             |                |
| user_password_expires    | varbinary(14)    | YES  |     | NULL                             |                |
+--------------------------+------------------+------+-----+----------------------------------+----------------+
MediaWiki版本:
1.36 – 1.38

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   |     | NULL                             |                |
| 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版本:
1.23 – 1.35

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版本:
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版本:
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版本:
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版本:
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    |                |
+------------------+---------------------+------+-----+---------+----------------+

Indexes

MediaWiki版本:
1.18

SHOW INDEX IN user;

+-------+------------+------------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name         | Seq_in_index | Column_name      | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+------------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| user  |          0 | PRIMARY          |            1 | user_id          | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          0 | user_name        |            1 | user_name        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          1 | user_email_token |            1 | user_email_token | A         |           0 |     NULL | NULL   | YES  | BTREE      |         |               |
| user  |          1 | user_email       |            1 | user_email       | A         |           0 |       50 | NULL   |      | BTREE      |         |               |
+-------+------------+------------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

参见