Difference between revisions of "Mediawiki user database"

From OnnoWiki
Jump to navigation Jump to search
 
Line 22: Line 22:
 
  | user_editcount          | int(11)        | YES  |    | NULL    |                |
 
  | user_editcount          | int(11)        | YES  |    | NULL    |                |
 
  +--------------------------+-----------------+------+-----+---------+----------------+
 
  +--------------------------+-----------------+------+-----+---------+----------------+
 +
 +
 +
 +
==Script Menambahkan User 1.13==
 +
 +
$name = 'Username'; #Username (MUST start with a capital letter)
 +
$pass = 'password'; #Password (plaintext, will be hashed later down)
 +
$email = 'email';  #Email (automatically gets confirmed after the creation process)
 +
$path = "/path/to/mediawiki";
 +
putenv( "MW_INSTALL_PATH={$path}" );
 +
require_once( "{$path}/includes/WebStart.php" );
 +
$pass = User::crypt( $pass );
 +
$user = User::createNew( $name, array( 'password' => $pass, 'email' => $email ) );
 +
$user->confirmEmail();
 +
$user->saveSettings(); 
 +
$ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
 +
$ssUpdate->doUpdate();
 +
 +
  
  
Line 58: Line 77:
  
 
===user_options===
 
===user_options===
{{MW 1.18|and earlier}}
 
 
:'''user_options''' is no longer used as of MediaWiki 1.16. See [[manual:User properties table]]
 
:'''user_options''' is no longer used as of MediaWiki 1.16. See [[manual:User properties table]]
  
Line 67: Line 85:
  
 
===user_token===
 
===user_token===
{{MW 1.4|and after}}
 
 
:'''user_token''' is a pseudorandomly generated value. When a user checks "Remember my login on this browser" the value is stored in a persistent browser cookie <tt>${wgCookiePrefix}Token</tt> that authenticates the user while being resistant to spoofing.
 
:'''user_token''' is a pseudorandomly generated value. When a user checks "Remember my login on this browser" the value is stored in a persistent browser cookie <tt>${wgCookiePrefix}Token</tt> that authenticates the user while being resistant to spoofing.
  
Line 74: Line 91:
  
 
===user_email_token===
 
===user_email_token===
{{MW 1.5|and after}}
 
 
'''user_email_token''' is a token used for confirming an email address.  See User::newFromConfirmationCode in User.php
 
'''user_email_token''' is a token used for confirming an email address.  See User::newFromConfirmationCode in User.php
  
Line 81: Line 97:
  
 
===user_registration===
 
===user_registration===
{{MW 1.6|and after}}
 
 
'''user_registration''' is the timestamp of when the user registered.
 
'''user_registration''' is the timestamp of when the user registered.
  
 
===user_editcount===
 
===user_editcount===
{{MW 1.9|and after}}
 
 
'''user_editcount'''
 
'''user_editcount'''
 
: Count of edits and edit-like actions.
 
: Count of edits and edit-like actions.
Line 92: Line 106:
  
 
===user_emailauthenticationtimestamp===
 
===user_emailauthenticationtimestamp===
{{MW 1.3|and before}}
+
 
 
Removed in v1.4.
 
Removed in v1.4.
  
 
===user_password_expires===
 
===user_password_expires===
{{MW 1.23|and after}}
 
  
 
Date when user's password expires; null for no expiration date.  Can also be set manually by calling User->expirePassword().
 
Date when user's password expires; null for no expiration date.  Can also be set manually by calling User->expirePassword().
 +
 +
 +
 +
 +
==Referensi==
 +
 +
* http://www.mediawiki.org/wiki/Manual:User_table

Latest revision as of 05:41, 20 November 2014

  • nama database : mediawiki (kalau masih belajar)
  • nama tabel : user atau wiki_user

DESCRIBE wiki_user

+--------------------------+-----------------+------+-----+---------+----------------+
| Field                    | Type            | Null | Key | Default | Extra          |
+--------------------------+-----------------+------+-----+---------+----------------+
| user_id                  | int(5) unsigned | NO   | PRI | NULL    | auto_increment |
| user_name                | varchar(255)    | NO   | UNI |         |                |
| user_real_name           | varchar(255)    | NO   |     |         |                |
| user_password            | tinyblob        | NO   |     | NULL    |                |
| user_newpassword         | tinyblob        | NO   |     | NULL    |                |
| user_newpass_time        | char(14)        | YES  |     | NULL    |                |
| user_email               | tinytext        | NO   | MUL | NULL    |                |
| user_touched             | char(14)        | NO   |     |         |                |
| user_token               | char(32)        | NO   |     |         |                |
| user_email_authenticated | char(14)        | YES  |     | NULL    |                |
| user_email_token         | char(32)        | YES  | MUL | NULL    |                |
| user_email_token_expires | char(14)        | YES  |     | NULL    |                |
| user_registration        | char(14)        | YES  |     | NULL    |                |
| user_editcount           | int(11)         | YES  |     | NULL    |                |
+--------------------------+-----------------+------+-----+---------+----------------+


Script Menambahkan User 1.13

$name = 'Username'; #Username (MUST start with a capital letter)
$pass = 'password'; #Password (plaintext, will be hashed later down)
$email = 'email';   #Email (automatically gets confirmed after the creation process)
$path = "/path/to/mediawiki";
putenv( "MW_INSTALL_PATH={$path}" );
require_once( "{$path}/includes/WebStart.php" );
$pass = User::crypt( $pass );
$user = User::createNew( $name, array( 'password' => $pass, 'email' => $email ) );
$user->confirmEmail();
$user->saveSettings();  
$ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
$ssUpdate->doUpdate();



Fields

Some of this information was adapted from schema.doc in the MediaWiki docs/ directory.

user_id

user_id is the primary key, used to uniquely identify a user

user_name

user_name: Usernames must be unique, and must not be in the form of an IP address. Shouldn't allow slashes or case conflicts. Spaces are allowed, and are not converted to underscores like titles. (Conflicts?)

user_real_name

Template:MW 1.3

user_real_name stores the user's real name (optional) as provided by the user in their "Preferences" section.

user_password

user_password is one of two formats, depending on the setting of $wgPasswordSalt:
-If $wgPasswordSalt is true (default) it is a concatenation of:
  • The string ":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.
-If $wgPasswordSalt is false, it is a concatenation of:
  • The string ":A:" and
  • The MD5 hash of the password.

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

user_email Note: email should be restricted, not public info. Same with passwords. ;)

user_options

user_options is no longer used as of MediaWiki 1.16. See manual:User properties table
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. note: the user_touched time resets when a user is left a talkpage message.

user_token

user_token is a pseudorandomly generated value. 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 is the timestamp of when the user email was authenticated. Defaults to NULL.

user_email_token

user_email_token is a token used for confirming an email address. See User::newFromConfirmationCode in User.php

user_email_token_expires

user_email_token_expires is the expiration timestamp of the email token.

user_registration

user_registration is the timestamp of when the user registered.

user_editcount

user_editcount

Count of edits and edit-like actions.
*NOT* intended to be an accurate copy of COUNT(*) WHERE rev_user=user_id. May contain NULL for old accounts if batch-update scripts haven't been run, as well as listing deleted edits and other myriad ways it could be out of sync. Execute the script initEditCount.php to update this table column.
Meant primarily for heuristic checks to give an impression of whether the account has been used much.

user_emailauthenticationtimestamp

Removed in v1.4.

user_password_expires

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



Referensi