mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
- improvements to search indexing performance, espacially tidy() by adding a word_count column, the database update from b5 to next version will take quite a while on bigger databases, I also lowered the default common word threshold from 20 to 5 percent, big boards might want to use 3 or 2 percent, 20 was way too high
- added some keys to ACL tables, great improvement of auth query performance - we will only add new language strings to install.php language file and won't modify any, if a language file is updated before phpBB is updated, the updater will not overwrite the user's language with english if install.php was modified git-svn-id: file:///svn/phpbb/trunk@7182 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
5e06885ea4
commit
ce8b00801e
13 changed files with 298 additions and 63 deletions
|
@ -810,6 +810,7 @@ function get_schema_struct()
|
|||
'KEYS' => array(
|
||||
'group_id' => array('INDEX', 'group_id'),
|
||||
'auth_opt_id' => array('INDEX', 'auth_option_id'),
|
||||
'auth_role_id' => array('INDEX', 'auth_role_id'),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -849,6 +850,9 @@ function get_schema_struct()
|
|||
'auth_setting' => array('TINT:2', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => array('role_id', 'auth_option_id'),
|
||||
'KEYS' => array(
|
||||
'auth_option_id' => array('INDEX', 'auth_option_id'),
|
||||
),
|
||||
);
|
||||
|
||||
$schema_data['phpbb_acl_users'] = array(
|
||||
|
@ -862,6 +866,7 @@ function get_schema_struct()
|
|||
'KEYS' => array(
|
||||
'user_id' => array('INDEX', 'user_id'),
|
||||
'auth_option_id' => array('INDEX', 'auth_option_id'),
|
||||
'auth_role_id' => array('INDEX', 'auth_role_id'),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -1461,10 +1466,12 @@ function get_schema_struct()
|
|||
'word_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'word_text' => array('VCHAR_UNI', ''),
|
||||
'word_common' => array('BOOL', 0),
|
||||
'word_count' => array('UINT', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => 'word_id',
|
||||
'KEYS' => array(
|
||||
'wrd_txt' => array('UNIQUE', 'word_text'),
|
||||
'wrd_cnt' => array('INDEX', 'word_count'),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -520,8 +520,6 @@ class auth
|
|||
' . (($sql_user) ? 'AND a.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts",
|
||||
|
||||
'ORDER_BY' => 'a.forum_id, ao.auth_option'
|
||||
));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
@ -533,60 +531,92 @@ class auth
|
|||
$db->sql_freeresult($result);
|
||||
|
||||
// Now grab group settings ... ACL_NEVER overrides ACL_YES so act appropriatley
|
||||
$sql = $db->sql_build_query('SELECT', array(
|
||||
$sql_ary[] = $db->sql_build_query('SELECT', array(
|
||||
'SELECT' => 'ug.user_id, ao.auth_option, a.forum_id, a.auth_setting, a.auth_role_id, r.auth_setting as role_auth_setting',
|
||||
|
||||
'FROM' => array(
|
||||
ACL_GROUPS_TABLE => 'a',
|
||||
USER_GROUP_TABLE => 'ug',
|
||||
ACL_OPTIONS_TABLE => 'ao',
|
||||
ACL_GROUPS_TABLE => 'a'
|
||||
),
|
||||
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
||||
'ON' => 'a.group_id = ug.group_id'
|
||||
),
|
||||
'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'),
|
||||
'ON' => 'a.auth_role_id = r.role_id'
|
||||
)
|
||||
),
|
||||
|
||||
'WHERE' => 'ao.auth_option_id = a.auth_option_id
|
||||
AND a.group_id = ug.group_id
|
||||
AND ug.user_pending = 0
|
||||
' . (($sql_user) ? 'AND ug.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts"
|
||||
));
|
||||
|
||||
$sql_ary[] = $db->sql_build_query('SELECT', array(
|
||||
'SELECT' => 'ug.user_id, a.forum_id, a.auth_setting, a.auth_role_id, r.auth_setting as role_auth_setting, ao.auth_option' ,
|
||||
|
||||
'FROM' => array(
|
||||
ACL_OPTIONS_TABLE => 'ao'
|
||||
|
||||
),
|
||||
|
||||
'LEFT_JOIN' => array(
|
||||
|
||||
array(
|
||||
'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'),
|
||||
'ON' => 'r.auth_option_id = ao.auth_option_id'
|
||||
),
|
||||
array(
|
||||
'FROM' => array(ACL_GROUPS_TABLE => 'a'),
|
||||
'ON' => 'a.auth_role_id = r.role_id'
|
||||
),
|
||||
array(
|
||||
'FROM' => array(ACL_OPTIONS_TABLE => 'ao'),
|
||||
'ON' => '(ao.auth_option_id = a.auth_option_id OR ao.auth_option_id = r.auth_option_id)'
|
||||
),
|
||||
'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
||||
'ON' => 'ug.group_id = a.group_id'
|
||||
)
|
||||
|
||||
),
|
||||
|
||||
'WHERE' => 'ug.user_pending = 0
|
||||
' . (($sql_user) ? 'AND ug.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts",
|
||||
$sql_opts"
|
||||
));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
||||
foreach ($sql_ary as $sql)
|
||||
{
|
||||
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] != ACL_NEVER))
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$setting = ($row['auth_role_id']) ? $row['role_auth_setting'] : $row['auth_setting'];
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $setting;
|
||||
|
||||
// Check for existence of ACL_YES if an option got set to ACL_NEVER
|
||||
if ($setting == ACL_NEVER)
|
||||
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] != ACL_NEVER))
|
||||
{
|
||||
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
|
||||
$setting = ($row['auth_role_id']) ? $row['role_auth_setting'] : $row['auth_setting'];
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $setting;
|
||||
|
||||
if (isset($hold_ary[$row['user_id']][$row['forum_id']][$flag]) && $hold_ary[$row['user_id']][$row['forum_id']][$flag] == ACL_YES)
|
||||
// Check for existence of ACL_YES if an option got set to ACL_NEVER
|
||||
if ($setting == ACL_NEVER)
|
||||
{
|
||||
unset($hold_ary[$row['user_id']][$row['forum_id']][$flag]);
|
||||
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
|
||||
|
||||
if (in_array(ACL_YES, $hold_ary[$row['user_id']][$row['forum_id']]))
|
||||
if (isset($hold_ary[$row['user_id']][$row['forum_id']][$flag]) && $hold_ary[$row['user_id']][$row['forum_id']][$flag] == ACL_YES)
|
||||
{
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$flag] = ACL_YES;
|
||||
unset($hold_ary[$row['user_id']][$row['forum_id']][$flag]);
|
||||
|
||||
if (in_array(ACL_YES, $hold_ary[$row['user_id']][$row['forum_id']]))
|
||||
{
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$flag] = ACL_YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $hold_ary;
|
||||
}
|
||||
|
|
|
@ -1112,13 +1112,14 @@ class fulltext_native extends search_backend
|
|||
$db->sql_freeresult($result);
|
||||
$new_words = array_diff($unique_add_words, array_keys($word_ids));
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
if (sizeof($new_words))
|
||||
{
|
||||
$sql_ary = array();
|
||||
|
||||
foreach ($new_words as $word)
|
||||
{
|
||||
$sql_ary[] = array('word_text' => $word);
|
||||
$sql_ary[] = array('word_text' => $word, 'word_count' => 0);
|
||||
}
|
||||
$db->return_on_error = true;
|
||||
$db->sql_multi_insert(SEARCH_WORDLIST_TABLE, $sql_ary);
|
||||
|
@ -1126,6 +1127,10 @@ class fulltext_native extends search_backend
|
|||
}
|
||||
unset($new_words, $sql_ary);
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->sql_transaction('begin');
|
||||
}
|
||||
|
||||
// now update the search match table, remove links to removed words and add links to new words
|
||||
foreach ($words['del'] as $word_in => $word_ary)
|
||||
|
@ -1145,6 +1150,12 @@ class fulltext_native extends search_backend
|
|||
AND post_id = ' . intval($post_id) . "
|
||||
AND title_match = $title_match";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = word_count - 1
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
$db->sql_query($sql);
|
||||
|
||||
unset($sql_in);
|
||||
}
|
||||
}
|
||||
|
@ -1161,10 +1172,17 @@ class fulltext_native extends search_backend
|
|||
FROM " . SEARCH_WORDLIST_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('word_text', $word_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = word_count + 1
|
||||
WHERE ' . $db->sql_in_set('word_text', $word_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
$db->return_on_error = false;
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
// destroy cached search results containing any of the words removed or added
|
||||
$this->destroy_cache(array_unique(array_merge($words['add']['post'], $words['add']['title'], $words['del']['post'], $words['del']['title'])), array($poster_id));
|
||||
|
||||
|
@ -1182,13 +1200,45 @@ class fulltext_native extends search_backend
|
|||
|
||||
if (sizeof($post_ids))
|
||||
{
|
||||
$sql = 'SELECT w.word_id, m.title_match
|
||||
FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w
|
||||
WHERE ' . $db->sql_in_set('m.post_id', $post_ids) . '
|
||||
AND w.word_id = m.word_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$message_word_ids = $title_word_ids = $word_texts = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['title_match'])
|
||||
{
|
||||
$title_word_ids[] = $row['word_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$message_word_ids[] = $row['word_id'];
|
||||
}
|
||||
$word_texts[] = $row['word_text'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = word_count - 1
|
||||
WHERE ' . $db->sql_in_set('word_id', $title_word_ids);
|
||||
$db->sql_query($sql);
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = word_count - 1
|
||||
WHERE ' . $db->sql_in_set('word_id', $message_word_ids);
|
||||
$db->sql_query($sql);
|
||||
|
||||
unset($title_word_ids);
|
||||
unset($message_word_ids);
|
||||
|
||||
$sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('post_id', $post_ids);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// SEARCH_WORDLIST_TABLE will be updated by tidy()
|
||||
$this->destroy_cache(array(), $author_ids);
|
||||
$this->destroy_cache(array_unique($word_texts), $author_ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1214,39 +1264,32 @@ class fulltext_native extends search_backend
|
|||
{
|
||||
$common_threshold = ((double) $config['fulltext_native_common_thres']) / 100.0;
|
||||
// First, get the IDs of common words
|
||||
$sql = 'SELECT word_id
|
||||
FROM ' . SEARCH_WORDMATCH_TABLE . '
|
||||
GROUP BY word_id
|
||||
HAVING COUNT(word_id) > ' . floor($config['num_posts'] * $common_threshold);
|
||||
$sql = 'SELECT word_id, word_text
|
||||
FROM ' . SEARCH_WORDLIST_TABLE . '
|
||||
WHERE word_count > ' . floor($config['num_posts'] * $common_threshold) . '
|
||||
OR word_common = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$sql_in = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql_in[] = $row['word_id'];
|
||||
$destroy_cache_words[] = $row['word_text'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_in))
|
||||
{
|
||||
// Get the text of those new common words
|
||||
$sql = 'SELECT word_text
|
||||
FROM ' . SEARCH_WORDLIST_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$destroy_cache_words[] = $row['word_text'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Flag the words
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_common = 1
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
$db->sql_query($sql);
|
||||
|
||||
// by setting search_last_gc to the new time here we make sure that if a user reloads because the
|
||||
// following query takes too long, he won't run into it again
|
||||
set_config('search_last_gc', time(), true);
|
||||
|
||||
// Delete the matches
|
||||
$sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
|
@ -1255,8 +1298,11 @@ class fulltext_native extends search_backend
|
|||
unset($sql_in);
|
||||
}
|
||||
|
||||
// destroy cached search results containing any of the words that are now common or were removed
|
||||
$this->destroy_cache(array_unique($destroy_cache_words));
|
||||
if (sizeof($destroy_cache_words))
|
||||
{
|
||||
// destroy cached search results containing any of the words that are now common or were removed
|
||||
$this->destroy_cache(array_unique($destroy_cache_words));
|
||||
}
|
||||
|
||||
set_config('search_last_gc', time(), true);
|
||||
}
|
||||
|
|
|
@ -320,6 +320,7 @@ $database_update_info = array(
|
|||
'session_forwarded_for' => array('VCHAR:255', ''),
|
||||
),
|
||||
),
|
||||
// Change the following columns...
|
||||
'change_columns' => array(
|
||||
USERS_TABLE => array(
|
||||
'user_options' => array('UINT:11', 895),
|
||||
|
@ -353,6 +354,13 @@ $database_update_info = array(
|
|||
),
|
||||
// Changes from 3.0.b5 to the next version
|
||||
'3.0.b5' => array(
|
||||
// Add the following columns
|
||||
'add_columns' => array(
|
||||
SEARCH_WORDLIST_TABLE => array(
|
||||
'word_count' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
// Change the following columns...
|
||||
'change_columns' => array(
|
||||
TOPICS_TABLE => array(
|
||||
'poll_title' => array('STEXT_UNI', ''),
|
||||
|
@ -367,10 +375,24 @@ $database_update_info = array(
|
|||
'username_clean',
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
SEARCH_WORDLIST_TABLE => array(
|
||||
'wrd_cnt' => array('word_count'),
|
||||
),
|
||||
ACL_GROUPS_TABLE => array(
|
||||
'auth_role_id' => array('auth_role_id'),
|
||||
),
|
||||
ACL_USERS_TABLE => array(
|
||||
'auth_role_id' => array('auth_role_id'),
|
||||
),
|
||||
ACL_ROLES_DATA_TABLE => array(
|
||||
'auth_option_id' => array('auth_option_id'),
|
||||
),
|
||||
),
|
||||
// Add the following unique indexes
|
||||
'add_unique_index' => array(
|
||||
SEARCH_WORDMATCH_TABLE => array(
|
||||
'unique_match' => array('word_id', 'post_id', 'title_match'),
|
||||
'unique_match' => array('word_id', 'post_id', 'title_match'),
|
||||
),
|
||||
USERS_TABLE => array(
|
||||
'username_clean' => array('username_clean'),
|
||||
|
@ -573,6 +595,18 @@ foreach ($database_update_info as $version => $schema_changes)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add indexes?
|
||||
if (!empty($schema_changes['add_index']))
|
||||
{
|
||||
foreach ($schema_changes['add_index'] as $table => $index_array)
|
||||
{
|
||||
foreach ($index_array as $index_name => $column)
|
||||
{
|
||||
sql_create_index($dbms, $index_name, $table, $column);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_write_result($no_updates, $errored, $error_ary);
|
||||
|
@ -703,6 +737,48 @@ if (version_compare($current_version, '3.0.b4', '<='))
|
|||
$no_updates = false;
|
||||
}
|
||||
|
||||
if (version_compare($current_version, '3.0.b6', '<='))
|
||||
{
|
||||
if ($config['fulltext_native_common_thres'] == 20)
|
||||
{
|
||||
set_config('fulltext_native_common_thres', '5');
|
||||
}
|
||||
|
||||
$sql = 'SELECT m.word_id, COUNT(m.word_id) as word_count
|
||||
FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w
|
||||
WHERE m.word_id = w.word_id
|
||||
AND w.word_common = 0
|
||||
GROUP BY m.word_id
|
||||
ORDER BY word_count ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$value = 0;
|
||||
$sql_in = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($value != $row['word_count'] && $value != 0 || sizeof($sql_in) > 500)
|
||||
{
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = ' . $value . '
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
$db->sql_query($sql);
|
||||
$sql_in = array();
|
||||
}
|
||||
$value = $row['word_count'];
|
||||
$sql_in[] = $row['word_id'];
|
||||
}
|
||||
|
||||
if (sizeof($sql_in))
|
||||
{
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . '
|
||||
SET word_count = ' . $value . '
|
||||
WHERE ' . $db->sql_in_set('word_id', $sql_in);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
unset($sql_in);
|
||||
$no_updates = false;
|
||||
}
|
||||
|
||||
_write_result($no_updates, $errored, $error_ary);
|
||||
|
||||
$error_ary = array();
|
||||
|
@ -1270,6 +1346,30 @@ function sql_create_unique_index($dbms, $index_name, $table_name, $column)
|
|||
}
|
||||
}
|
||||
|
||||
function sql_create_index($dbms, $index_name, $table_name, $column)
|
||||
{
|
||||
global $dbms_type_map, $db;
|
||||
global $errored, $error_ary;
|
||||
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'firebird':
|
||||
case 'postgres':
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
case 'oracle':
|
||||
case 'sqlite':
|
||||
$sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
|
||||
_sql($sql, $errored, $error_ary);
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
$sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]';
|
||||
_sql($sql, $errored, $error_ary);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change column type (not name!)
|
||||
*/
|
||||
|
|
|
@ -202,7 +202,12 @@ class install_update extends module
|
|||
{
|
||||
$lang = array();
|
||||
include($this->new_location . 'language/en/install.php');
|
||||
$user->lang = array_merge($user->lang, $lang);
|
||||
// only add new keys to user's language in english
|
||||
$new_keys = array_diff(array_keys($lang), array_keys($user->lang));
|
||||
foreach ($new_keys as $i => $new_key)
|
||||
{
|
||||
$user->lang[$new_key] = $lang[$new_key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ CREATE TABLE phpbb_acl_groups (
|
|||
|
||||
CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups(group_id);;
|
||||
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups(auth_option_id);;
|
||||
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups(auth_role_id);;
|
||||
|
||||
# Table: 'phpbb_acl_options'
|
||||
CREATE TABLE phpbb_acl_options (
|
||||
|
@ -113,6 +114,7 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
|
||||
ALTER TABLE phpbb_acl_roles_data ADD PRIMARY KEY (role_id, auth_option_id);;
|
||||
|
||||
CREATE INDEX phpbb_acl_roles_data_auth_option_id ON phpbb_acl_roles_data(auth_option_id);;
|
||||
|
||||
# Table: 'phpbb_acl_users'
|
||||
CREATE TABLE phpbb_acl_users (
|
||||
|
@ -125,6 +127,7 @@ CREATE TABLE phpbb_acl_users (
|
|||
|
||||
CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);;
|
||||
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);;
|
||||
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);;
|
||||
|
||||
# Table: 'phpbb_banlist'
|
||||
CREATE TABLE phpbb_banlist (
|
||||
|
@ -924,12 +927,14 @@ ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);;
|
|||
CREATE TABLE phpbb_search_wordlist (
|
||||
word_id INTEGER NOT NULL,
|
||||
word_text VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||
word_common INTEGER DEFAULT 0 NOT NULL
|
||||
word_common INTEGER DEFAULT 0 NOT NULL,
|
||||
word_count INTEGER DEFAULT 0 NOT NULL
|
||||
);;
|
||||
|
||||
ALTER TABLE phpbb_search_wordlist ADD PRIMARY KEY (word_id);;
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist(word_text);;
|
||||
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist(word_count);;
|
||||
|
||||
CREATE GENERATOR phpbb_search_wordlist_gen;;
|
||||
SET GENERATOR phpbb_search_wordlist_gen TO 0;;
|
||||
|
|
|
@ -71,6 +71,9 @@ GO
|
|||
CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_options'
|
||||
|
@ -139,6 +142,9 @@ ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD
|
|||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [auth_option_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_users'
|
||||
|
@ -158,6 +164,9 @@ GO
|
|||
CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_banlist'
|
||||
|
@ -1098,7 +1107,8 @@ GO
|
|||
CREATE TABLE [phpbb_search_wordlist] (
|
||||
[word_id] [int] IDENTITY (1, 1) NOT NULL ,
|
||||
[word_text] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||
[word_common] [int] DEFAULT (0) NOT NULL
|
||||
[word_common] [int] DEFAULT (0) NOT NULL ,
|
||||
[word_count] [int] DEFAULT (0) NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
@ -1112,6 +1122,9 @@ GO
|
|||
CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_search_wordmatch'
|
||||
|
|
|
@ -38,7 +38,8 @@ CREATE TABLE phpbb_acl_groups (
|
|||
auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
KEY group_id (group_id),
|
||||
KEY auth_opt_id (auth_option_id)
|
||||
KEY auth_opt_id (auth_option_id),
|
||||
KEY auth_role_id (auth_role_id)
|
||||
);
|
||||
|
||||
|
||||
|
@ -72,7 +73,8 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (role_id, auth_option_id)
|
||||
PRIMARY KEY (role_id, auth_option_id),
|
||||
KEY auth_option_id (auth_option_id)
|
||||
);
|
||||
|
||||
|
||||
|
@ -84,7 +86,8 @@ CREATE TABLE phpbb_acl_users (
|
|||
auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
KEY user_id (user_id),
|
||||
KEY auth_option_id (auth_option_id)
|
||||
KEY auth_option_id (auth_option_id),
|
||||
KEY auth_role_id (auth_role_id)
|
||||
);
|
||||
|
||||
|
||||
|
@ -638,8 +641,10 @@ CREATE TABLE phpbb_search_wordlist (
|
|||
word_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
word_text blob NOT NULL,
|
||||
word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (word_id),
|
||||
UNIQUE wrd_txt (word_text(255))
|
||||
UNIQUE wrd_txt (word_text(255)),
|
||||
KEY wrd_cnt (word_count)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ CREATE TABLE phpbb_acl_groups (
|
|||
auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
KEY group_id (group_id),
|
||||
KEY auth_opt_id (auth_option_id)
|
||||
KEY auth_opt_id (auth_option_id),
|
||||
KEY auth_role_id (auth_role_id)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
@ -72,7 +73,8 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (role_id, auth_option_id)
|
||||
PRIMARY KEY (role_id, auth_option_id),
|
||||
KEY auth_option_id (auth_option_id)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
@ -84,7 +86,8 @@ CREATE TABLE phpbb_acl_users (
|
|||
auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
auth_setting tinyint(2) DEFAULT '0' NOT NULL,
|
||||
KEY user_id (user_id),
|
||||
KEY auth_option_id (auth_option_id)
|
||||
KEY auth_option_id (auth_option_id),
|
||||
KEY auth_role_id (auth_role_id)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
@ -638,8 +641,10 @@ CREATE TABLE phpbb_search_wordlist (
|
|||
word_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
word_text varchar(255) DEFAULT '' NOT NULL,
|
||||
word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (word_id),
|
||||
UNIQUE wrd_txt (word_text)
|
||||
UNIQUE wrd_txt (word_text),
|
||||
KEY wrd_cnt (word_count)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id)
|
|||
/
|
||||
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id)
|
||||
/
|
||||
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id)
|
||||
/
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_options'
|
||||
|
@ -186,6 +188,8 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
)
|
||||
/
|
||||
|
||||
CREATE INDEX phpbb_acl_roles_data_auth_option_id ON phpbb_acl_roles_data (auth_option_id)
|
||||
/
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_users'
|
||||
|
@ -203,6 +207,8 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id)
|
|||
/
|
||||
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id)
|
||||
/
|
||||
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id)
|
||||
/
|
||||
|
||||
/*
|
||||
Table: 'phpbb_banlist'
|
||||
|
@ -1232,11 +1238,14 @@ CREATE TABLE phpbb_search_wordlist (
|
|||
word_id number(8) NOT NULL,
|
||||
word_text varchar2(765) DEFAULT '' ,
|
||||
word_common number(1) DEFAULT '0' NOT NULL,
|
||||
word_count number(8) DEFAULT '0' NOT NULL,
|
||||
CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id),
|
||||
CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text)
|
||||
)
|
||||
/
|
||||
|
||||
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count)
|
||||
/
|
||||
|
||||
CREATE SEQUENCE phpbb_search_wordlist_seq
|
||||
/
|
||||
|
|
|
@ -125,6 +125,7 @@ CREATE TABLE phpbb_acl_groups (
|
|||
|
||||
CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id);
|
||||
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id);
|
||||
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_options'
|
||||
|
@ -169,6 +170,7 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
PRIMARY KEY (role_id, auth_option_id)
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_acl_roles_data_auth_option_id ON phpbb_acl_roles_data (auth_option_id);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_acl_users'
|
||||
|
@ -183,6 +185,7 @@ CREATE TABLE phpbb_acl_users (
|
|||
|
||||
CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
|
||||
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
|
||||
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_banlist'
|
||||
|
@ -848,10 +851,12 @@ CREATE TABLE phpbb_search_wordlist (
|
|||
word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'),
|
||||
word_text varchar(255) DEFAULT '' NOT NULL,
|
||||
word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0),
|
||||
word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0),
|
||||
PRIMARY KEY (word_id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
|
||||
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_search_wordmatch'
|
||||
|
|
|
@ -90,7 +90,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('forwarded_for_chec
|
|||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('full_folder_action', '2');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_max_word_len', '254');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_min_word_len', '4');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_common_thres', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_common_thres', '5');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_load_upd', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_max_chars', '14');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_min_chars', '3');
|
||||
|
|
|
@ -42,6 +42,7 @@ CREATE TABLE phpbb_acl_groups (
|
|||
|
||||
CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id);
|
||||
CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id);
|
||||
CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id);
|
||||
|
||||
# Table: 'phpbb_acl_options'
|
||||
CREATE TABLE phpbb_acl_options (
|
||||
|
@ -74,6 +75,7 @@ CREATE TABLE phpbb_acl_roles_data (
|
|||
PRIMARY KEY (role_id, auth_option_id)
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_acl_roles_data_auth_option_id ON phpbb_acl_roles_data (auth_option_id);
|
||||
|
||||
# Table: 'phpbb_acl_users'
|
||||
CREATE TABLE phpbb_acl_users (
|
||||
|
@ -86,6 +88,7 @@ CREATE TABLE phpbb_acl_users (
|
|||
|
||||
CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
|
||||
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
|
||||
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
|
||||
|
||||
# Table: 'phpbb_banlist'
|
||||
CREATE TABLE phpbb_banlist (
|
||||
|
@ -616,10 +619,12 @@ CREATE TABLE phpbb_search_results (
|
|||
CREATE TABLE phpbb_search_wordlist (
|
||||
word_id INTEGER PRIMARY KEY NOT NULL ,
|
||||
word_text varchar(255) NOT NULL DEFAULT '',
|
||||
word_common INTEGER UNSIGNED NOT NULL DEFAULT '0'
|
||||
word_common INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
word_count INTEGER UNSIGNED NOT NULL DEFAULT '0'
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text);
|
||||
CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count);
|
||||
|
||||
# Table: 'phpbb_search_wordmatch'
|
||||
CREATE TABLE phpbb_search_wordmatch (
|
||||
|
|
Loading…
Add table
Reference in a new issue