Manual: Tabela do Utilizador
A tabela user é onde o MediaWiki guarda a informação sobre os utilizadores. Se utilizar Postgres, esta tabela é chamada de mwuser antes da versão 1.37.
Campos
Alguma desta informação foi adaptada de schema.doc na diretoria docs/ do MediaWiki.
user_id
user_id é a chave primária, utilizada para identificar exclusivamente um utilizador
user_name
user_name: Os nomes de utilizador devem ser únicos, e não devem estar na forma de um endereço de IP. Não deveria permitir barras oblíquas ou conflitos de casos. Consulte também Manual:$wgInvalidUsernameCharacters. Os espaços são permitidos, e os sublinhados são convertidos para espaços (o oposto do que com os nomes de página).
user_real_name
| Versão MediaWiki: | ≥ 1.3 |
user_real_name guarda o nome real do utilizador (opcional) conforme fornecido pelo utilizador na secção "Preferências".
Este campo fornece um nome real visível ao público para as páginas ? ação=créditos.
Desativar esta funcionalidade com $wgHiddenPrefs[] = 'realname'; e $wgActions['credits'] = false;
user_password
user_password é um dos três formatos, dependendo da definição de $wgPasswordDefault:
- Desde o MediaWiki 1.24, $wgPasswordDefault predefine para pbkdf2. Neste caso irá obter uma concatenação do seguinte:
- A string ":pbkdf2:".
- O algoritmo de hashing utilizado dentro da camada pbkdf2, por predefinição "sha512".
- O caráter dois pontos (
:). - O custo para este algoritmo, por predefinição "30000".
- O caráter dois pontos (
:). - O comprimento da chave derivada; "64" por predefinição.
- O caráter dois pontos (
:).
- Base64 encoded salt of the hashing algorithm, e.g. "kkdejKlBYFV7+LP2m2thYA=="
- O caráter dois pontos (
:).
- O caráter dois pontos (
- And finally the base64 encoded result of the hashing algorithm (that had a (default) length of 128 bytes before base64 encoding).
The hash of the plain text user password.
- 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!...".
- For passwords written by MediaWiki 1.23 and older, if $wgPasswordSalt was true (default) it is a concatenation of the following:
- A string ":B:".
- A pseudo-random hexadecimal 31-bit salt between 0x0 and 0x7fff ffff (inclusive)
- O caráter dois pontos (
:).
- O caráter dois pontos (
- The MD5 hash of a concatenation of the salt, a dash ("-"), and the MD5 hash of the password.
- For passwords written by MediaWiki 1.23 and older, if $wgPasswordSalt was false, it is a concatenation of the following:
- A string ":A:".
- O hash MD5 da palavra-passe.
In wiki farms which use CentralAuth, this field can contain an outdated and unused value (T104500).
The canonical password value is stored in the gu_password field of the globaluser table.
user_newpassword
user_newpassword é gerado para a funcionalidade de mensagem de uma nova palavra-passe.
user_newpass_time
user_newpass_time é definido como a atual data/hora (wfTimestampNow()) quando é definida uma nova palavra-passe. Como as outras datas/horas, está no formato de data/hora do MediaWiki (yyyymmddhhmmss, por exemplo, 20130824025644).
user_email
In wiki farms which use CentralAuth, this field can contain an outdated and unused value (T104500).
The canonical email is stored in the gu_email field of the globaluser table.
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
| Versão MediaWiki: | ≥ 1.4 |
user_token is a pseudorandomly generated value.
When a user checks Manter-me autenticado 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 is the timestamp of when the user email was authenticated. Predefine para NULL.
user_email_token
| Versão MediaWiki: | ≥ 1.5 |
user_email_token is a token used for confirming an email address. Consulte User::newFromConfirmationCode em User.php
user_email_token_expires
user_email_token_expires is the expiration timestamp of the email token.
user_registration
| Versão MediaWiki: | ≥ 1.6 |
user_registration is the timestamp (date and time) of when the user registered. For old users, they may have a value of NULL for this field. The fixUserRegistration.php script can be used to back-populate this field.
user_editcount
| Versão MediaWiki: | ≥ 1.9 |
user_editcount is the rough number of edits and edit-like actions the user has performed. The following actions are counted as edits:
- 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)
- The redirect created from a page move (since version 1.38 until T296035 was fixed in version 1.44)
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.
A number of things could cause this value to be incorrect. For example, it may be out of date or, for old accounts, NULL if the update script (initEditCount.php) hasn't been run. Also, some deletions may not affect it consistently.
user_password_expires
| Versão MediaWiki: | ≥ 1.23 |
Date when user's password expires; null for no expiration date.
user_is_temp
| Versão 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.
Campos removidos
user_emailauthenticationtimestamp
| Versão MediaWiki: | ≤ 1.3 |
Removido na versão v1.4.
user_options
| Versão MediaWiki: | ≤ 1.18 |
(deprecated in 1.16) Consulte Manual: Tabela das Propriedades do utilizador.
Nas versões mais antigas do Mediawiki, é uma lista separada por novas linhas de pares "name=value" da informação de Special:Preferences. As contas de utilizador antigas que não se autenticaram desde que o campo deixou de ser utilizado podem ainda ter este campo definido.
Resumo de esquema
| Versão 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 | | +--------------------------+------------------+------+-----+----------------------------------+----------------+
| Versões do 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 | | +--------------------------+------------------+------+-----+----------------------------------+----------------+
| Versões do 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 | | +--------------------------+------------------+------+-----+----------------------------------+----------------+
| Versões do 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 | | +--------------------------+------------------+------+-----+----------------------------------+----------------+
| Versões do 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versão 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versões do 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versão 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versões do 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versão 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 | | +--------------------------+---------------------+------+-----+---------+----------------+
| Versão 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 | | +------------------+---------------------+------+-----+---------+----------------+
| Versão 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 | | +------------------+---------------------+------+-----+---------+----------------+
| Versões do 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 | | +------------------+---------------------+------+-----+---------+----------------+
Índices
| Versão 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 | | | +-------+------------+------------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+