[feature/passwords] Add schema changes for new hash types

PHPBB3-11610
This commit is contained in:
Marc Alexander 2013-06-17 23:04:22 +02:00
parent 4b81b93d10
commit dae4327cfc
9 changed files with 72 additions and 9 deletions

View file

@ -1862,7 +1862,7 @@ function get_schema_struct()
'user_regdate' => array('TIMESTAMP', 0),
'username' => array('VCHAR_CI', ''),
'username_clean' => array('VCHAR_CI', ''),
'user_password' => array('VCHAR_UNI:40', ''),
'user_password' => array('VCHAR_CI', ''),
'user_passchg' => array('TIMESTAMP', 0),
'user_pass_convert' => array('BOOL', 0),
'user_email' => array('VCHAR_UNI:100', ''),

View file

@ -0,0 +1,63 @@
<?php
/**
*
* @package migration
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
*
*/
class phpbb_db_migration_data_310_crypto extends phpbb_db_migration
{
public function effectively_installed()
{
$ret = false;
$this->db->sql_return_on_error(true);
// Set user_password to 64 character long string
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = '" . md5('foobar') . md5('foobar') . "'
WHERE user_id = '" . ANONYMOUS . "'";
$this->db->sql_query($sql);
$this->db->sql_return_on_error(false);
if ($this->db->sql_affectedrows())
{
$ret = true;
}
// Reset user password
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = ''
WHERE user_id = '" . ANONYMOUS . "'";
$this->db->sql_query($sql);
return $ret;
}
static public function depends_on()
{
return array('phpbb_db_migration_data_30x_3_0_11');
}
public function update_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_password' => array('VCHAR:255', ''),
),
),
);
}
public function revert_schema()
{
return array(
'change_columns' => array(
$this->table_prefix . 'users' => array(
'user_password' => array('VCHAR:40', ''),
),
),
);
}
}

View file

@ -1344,7 +1344,7 @@ CREATE TABLE phpbb_users (
user_regdate INTEGER DEFAULT 0 NOT NULL,
username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
user_password VARCHAR(40) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
user_password VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
user_passchg INTEGER DEFAULT 0 NOT NULL,
user_pass_convert INTEGER DEFAULT 0 NOT NULL,
user_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,

View file

@ -1644,7 +1644,7 @@ CREATE TABLE [phpbb_users] (
[user_regdate] [int] DEFAULT (0) NOT NULL ,
[username] [varchar] (255) DEFAULT ('') NOT NULL ,
[username_clean] [varchar] (255) DEFAULT ('') NOT NULL ,
[user_password] [varchar] (40) DEFAULT ('') NOT NULL ,
[user_password] [varchar] (255) DEFAULT ('') NOT NULL ,
[user_passchg] [int] DEFAULT (0) NOT NULL ,
[user_pass_convert] [int] DEFAULT (0) NOT NULL ,
[user_email] [varchar] (100) DEFAULT ('') NOT NULL ,

View file

@ -954,7 +954,7 @@ CREATE TABLE phpbb_users (
user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL,
username blob NOT NULL,
username_clean blob NOT NULL,
user_password varbinary(120) DEFAULT '' NOT NULL,
user_password blob DEFAULT '' NOT NULL,
user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL,
user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
user_email blob NOT NULL,

View file

@ -954,7 +954,7 @@ CREATE TABLE phpbb_users (
user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL,
username varchar(255) DEFAULT '' NOT NULL,
username_clean varchar(255) DEFAULT '' NOT NULL,
user_password varchar(40) DEFAULT '' NOT NULL,
user_password varchar(255) DEFAULT '' NOT NULL,
user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL,
user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
user_email varchar(100) DEFAULT '' NOT NULL,

View file

@ -958,7 +958,7 @@ CREATE TABLE phpbb_poll_votes (
topic_id number(8) DEFAULT '0' NOT NULL,
poll_option_id number(4) DEFAULT '0' NOT NULL,
vote_user_id number(8) DEFAULT '0' NOT NULL,
vote_user_ip varchar2(40) DEFAULT ''
vote_user_ip varchar2(40) DEFAULT ''
)
/
@ -1770,7 +1770,7 @@ CREATE TABLE phpbb_users (
user_regdate number(11) DEFAULT '0' NOT NULL,
username varchar2(255) DEFAULT '' ,
username_clean varchar2(255) DEFAULT '' ,
user_password varchar2(120) DEFAULT '' ,
user_password varchar2(255) DEFAULT '' ,
user_passchg number(11) DEFAULT '0' NOT NULL,
user_pass_convert number(1) DEFAULT '0' NOT NULL,
user_email varchar2(300) DEFAULT '' ,

View file

@ -1222,7 +1222,7 @@ CREATE TABLE phpbb_users (
user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0),
username varchar_ci DEFAULT '' NOT NULL,
username_clean varchar_ci DEFAULT '' NOT NULL,
user_password varchar(40) DEFAULT '' NOT NULL,
user_password varchar_ci DEFAULT '' NOT NULL,
user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0),
user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0),
user_email varchar(100) DEFAULT '' NOT NULL,

View file

@ -925,7 +925,7 @@ CREATE TABLE phpbb_users (
user_regdate INTEGER UNSIGNED NOT NULL DEFAULT '0',
username varchar(255) NOT NULL DEFAULT '',
username_clean varchar(255) NOT NULL DEFAULT '',
user_password varchar(40) NOT NULL DEFAULT '',
user_password varchar(255) NOT NULL DEFAULT '',
user_passchg INTEGER UNSIGNED NOT NULL DEFAULT '0',
user_pass_convert INTEGER UNSIGNED NOT NULL DEFAULT '0',
user_email varchar(100) NOT NULL DEFAULT '',