aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/create_schema_files.php18
-rw-r--r--phpBB/develop/mysql_upgrader.php37
-rw-r--r--phpBB/develop/update_email_hash.php57
3 files changed, 107 insertions, 5 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 52c72fc72c..b9017937c8 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -983,6 +983,7 @@ function get_schema_struct()
'confirm_type' => array('TINT:3', 0),
'code' => array('VCHAR:8', ''),
'seed' => array('UINT:10', 0),
+ 'attempts' => array('UINT', 0),
),
'PRIMARY_KEY' => array('session_id', 'confirm_id'),
'KEYS' => array(
@@ -1072,6 +1073,7 @@ function get_schema_struct()
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''),
'forum_flags' => array('TINT:4', 32),
+ 'forum_options' => array('UINT:20', 0),
'display_subforum_list' => array('BOOL', 1),
'display_on_index' => array('BOOL', 1),
'enable_indexing' => array('BOOL', 1),
@@ -1125,6 +1127,7 @@ function get_schema_struct()
'group_id' => array('UINT', NULL, 'auto_increment'),
'group_type' => array('TINT:4', 1),
'group_founder_manage' => array('BOOL', 0),
+ 'group_skip_auth' => array('BOOL', 0),
'group_name' => array('VCHAR_CI', ''),
'group_desc' => array('TEXT_UNI', ''),
'group_desc_bitfield' => array('VCHAR:255', ''),
@@ -1195,6 +1198,7 @@ function get_schema_struct()
'PRIMARY_KEY' => 'log_id',
'KEYS' => array(
'log_type' => array('INDEX', 'log_type'),
+ 'log_time' => array('INDEX', 'log_time'),
'forum_id' => array('INDEX', 'forum_id'),
'topic_id' => array('INDEX', 'topic_id'),
'reportee_id' => array('INDEX', 'reportee_id'),
@@ -1302,6 +1306,7 @@ function get_schema_struct()
'poster_ip' => array('INDEX', 'poster_ip'),
'poster_id' => array('INDEX', 'poster_id'),
'post_approved' => array('INDEX', 'post_approved'),
+ 'post_username' => array('INDEX', 'post_username'),
'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
),
);
@@ -1329,6 +1334,7 @@ function get_schema_struct()
'message_edit_count' => array('USINT', 0),
'to_address' => array('TEXT_UNI', ''),
'bcc_address' => array('TEXT_UNI', ''),
+ 'message_reported' => array('BOOL', 0),
),
'PRIMARY_KEY' => 'msg_id',
'KEYS' => array(
@@ -1404,6 +1410,7 @@ function get_schema_struct()
'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0),
+ 'field_show_on_vt' => array('BOOL', 0),
'field_show_profile' => array('BOOL', 0),
'field_hide' => array('BOOL', 0),
'field_no_view' => array('BOOL', 0),
@@ -1462,6 +1469,7 @@ function get_schema_struct()
'report_id' => array('UINT', NULL, 'auto_increment'),
'reason_id' => array('USINT', 0),
'post_id' => array('UINT', 0),
+ 'pm_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'user_notify' => array('BOOL', 0),
'report_closed' => array('BOOL', 0),
@@ -1469,6 +1477,10 @@ function get_schema_struct()
'report_text' => array('MTEXT_UNI', ''),
),
'PRIMARY_KEY' => 'report_id',
+ 'KEYS' => array(
+ 'post_id' => array('INDEX', 'post_id'),
+ 'pm_id' => array('INDEX', 'pm_id'),
+ ),
);
$schema_data['phpbb_reports_reasons'] = array(
@@ -1830,7 +1842,7 @@ function get_schema_struct()
'user_allow_viewonline' => array('BOOL', 1),
'user_allow_viewemail' => array('BOOL', 1),
'user_allow_massemail' => array('BOOL', 1),
- 'user_options' => array('UINT:11', 895),
+ 'user_options' => array('UINT:11', 230271),
'user_avatar' => array('VCHAR', ''),
'user_avatar_type' => array('TINT:2', 0),
'user_avatar_width' => array('USINT', 0),
@@ -1850,7 +1862,9 @@ function get_schema_struct()
'user_actkey' => array('VCHAR:32', ''),
'user_newpasswd' => array('VCHAR_UNI:40', ''),
'user_form_salt' => array('VCHAR_UNI:32', ''),
-
+ 'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time' => array('TIMESTAMP', 0),
),
'PRIMARY_KEY' => 'user_id',
'KEYS' => array(
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index 77341500e1..034c1c0c20 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -40,13 +40,18 @@ $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
-$mysql_indexer = false;
+$mysql_indexer = $drop_index = false;
if (strtolower($row['Type']) === 'mediumtext')
{
$mysql_indexer = true;
}
+if (strtolower($row['Key']) === 'mul')
+{
+ $drop_index = true;
+}
+
echo "USE $dbname;$newline$newline";
@@ -124,6 +129,13 @@ foreach ($schema_data as $table_name => $table_data)
// Create Table statement
$generator = $textimage = false;
+ // Do we need to DROP a fulltext index before we alter the table?
+ if ($table_name == ($prefix . 'posts') && $drop_index)
+ {
+ echo "ALTER TABLE {$table_name}{$newline}";
+ echo "DROP INDEX post_text,{$newline}DROP INDEX post_subject,{$newline}DROP INDEX post_content;{$newline}{$newline}";
+ }
+
$line = "ALTER TABLE {$table_name} $newline";
// Table specific so we don't get overlap
@@ -236,6 +248,12 @@ foreach ($schema_data as $table_name => $table_data)
$line .= "\tDEFAULT CHARSET=utf8 COLLATE=utf8_bin;$newline$newline";
echo $line . "$newline";
+
+ // Do we now need to re-add the fulltext index? ;)
+ if ($table_name == ($prefix . 'posts') && $drop_index)
+ {
+ echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text){$newline}";
+ }
}
/**
@@ -455,6 +473,7 @@ function get_schema_struct()
'confirm_type' => array('TINT:3', 0),
'code' => array('VCHAR:8', ''),
'seed' => array('UINT:10', 0),
+ 'attempts' => array('UINT', 0),
),
'PRIMARY_KEY' => array('session_id', 'confirm_id'),
'KEYS' => array(
@@ -544,6 +563,7 @@ function get_schema_struct()
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''),
'forum_flags' => array('TINT:4', 32),
+ 'forum_options' => array('UINT:20', 0),
'display_subforum_list' => array('BOOL', 1),
'display_on_index' => array('BOOL', 1),
'enable_indexing' => array('BOOL', 1),
@@ -597,6 +617,7 @@ function get_schema_struct()
'group_id' => array('UINT', NULL, 'auto_increment'),
'group_type' => array('TINT:4', 1),
'group_founder_manage' => array('BOOL', 0),
+ 'group_skip_auth' => array('BOOL', 0),
'group_name' => array('VCHAR_CI', ''),
'group_desc' => array('TEXT_UNI', ''),
'group_desc_bitfield' => array('VCHAR:255', ''),
@@ -667,6 +688,7 @@ function get_schema_struct()
'PRIMARY_KEY' => 'log_id',
'KEYS' => array(
'log_type' => array('INDEX', 'log_type'),
+ 'log_time' => array('INDEX', 'log_time'),
'forum_id' => array('INDEX', 'forum_id'),
'topic_id' => array('INDEX', 'topic_id'),
'reportee_id' => array('INDEX', 'reportee_id'),
@@ -801,6 +823,7 @@ function get_schema_struct()
'message_edit_count' => array('USINT', 0),
'to_address' => array('TEXT_UNI', ''),
'bcc_address' => array('TEXT_UNI', ''),
+ 'message_reported' => array('BOOL', 0),
),
'PRIMARY_KEY' => 'msg_id',
'KEYS' => array(
@@ -876,6 +899,7 @@ function get_schema_struct()
'field_validation' => array('VCHAR_UNI:20', ''),
'field_required' => array('BOOL', 0),
'field_show_on_reg' => array('BOOL', 0),
+ 'field_show_on_vt' => array('BOOL', 0),
'field_show_profile' => array('BOOL', 0),
'field_hide' => array('BOOL', 0),
'field_no_view' => array('BOOL', 0),
@@ -934,6 +958,7 @@ function get_schema_struct()
'report_id' => array('UINT', NULL, 'auto_increment'),
'reason_id' => array('USINT', 0),
'post_id' => array('UINT', 0),
+ 'pm_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'user_notify' => array('BOOL', 0),
'report_closed' => array('BOOL', 0),
@@ -941,6 +966,10 @@ function get_schema_struct()
'report_text' => array('MTEXT_UNI', ''),
),
'PRIMARY_KEY' => 'report_id',
+ 'KEYS' => array(
+ 'post_id' => array('INDEX', 'post_id'),
+ 'pm_id' => array('INDEX', 'pm_id'),
+ ),
);
$schema_data['phpbb_reports_reasons'] = array(
@@ -1302,7 +1331,7 @@ function get_schema_struct()
'user_allow_viewonline' => array('BOOL', 1),
'user_allow_viewemail' => array('BOOL', 1),
'user_allow_massemail' => array('BOOL', 1),
- 'user_options' => array('UINT:11', 895),
+ 'user_options' => array('UINT:11', 230271),
'user_avatar' => array('VCHAR', ''),
'user_avatar_type' => array('TINT:2', 0),
'user_avatar_width' => array('USINT', 0),
@@ -1322,7 +1351,9 @@ function get_schema_struct()
'user_actkey' => array('VCHAR:32', ''),
'user_newpasswd' => array('VCHAR_UNI:40', ''),
'user_form_salt' => array('VCHAR_UNI:32', ''),
-
+ 'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time' => array('TIMESTAMP', 0),
),
'PRIMARY_KEY' => 'user_id',
'KEYS' => array(
diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php
new file mode 100644
index 0000000000..80fd4bbc17
--- /dev/null
+++ b/phpBB/develop/update_email_hash.php
@@ -0,0 +1,57 @@
+<?php
+/**
+* Corrects user_email_hash values if DB moved from 32-bit system to 64-bit system or vice versa.
+* The CRC32 function in PHP generates different results for both systems.
+* @PHP dev team: no, a hexdec() applied to it does not solve the issue. And please document it.
+*
+*/
+die("Please read the first lines of this script for instructions on how to enable it");
+
+set_time_limit(0);
+
+define('IN_PHPBB', true);
+$phpbb_root_path = './../';
+$phpEx = substr(strrchr(__FILE__, '.'), 1);
+include($phpbb_root_path . 'common.' . $phpEx);
+
+// Start session management
+$user->session_begin();
+$auth->acl($user->data);
+$user->setup();
+
+$start = request_var('start', 0);
+$num_items = 1000;
+
+echo '<br />Updating user email hashes' . "\n";
+
+$sql = 'SELECT user_id, user_email
+ FROM ' . USERS_TABLE . '
+ ORDER BY user_id ASC';
+$result = $db->sql_query($sql);
+
+$echos = 0;
+while ($row = $db->sql_fetchrow($result))
+{
+ $echos++;
+
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_email_hash = '" . $db->sql_escape(phpbb_email_hash($row['user_email'])) . "'
+ WHERE user_id = " . (int) $row['user_id'];
+ $db->sql_query($sql);
+
+ if ($echos == 200)
+ {
+ echo '<br />';
+ $echos = 0;
+ }
+
+ echo '.';
+ flush();
+}
+$db->sql_freeresult($result);
+
+echo 'FINISHED';
+
+// Done
+$db->sql_close();
+?> \ No newline at end of file