手册: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 87% complete.
Other languages:
English • ‎español • ‎français • ‎polski • ‎português • ‎中文 • ‎日本語
手冊:索引 MediaWiki数据库布局 user table


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层用的散列函数,默认是“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應被限制,非公開資訊。 和密码相同。 若輸入詳細資訊,後果自負。 ;)
This field is not nullable, so users who have never supplied an email address have an empty string set.

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 "Keep me logged in (for up to 365 days)" 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

使用者密碼逾期日期;無逾期日期為null。 也可以透過呼叫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版本: 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    |                |
+------------------+---------------------+------+-----+---------+----------------+

参见