From e855a348e3bb762ed2afd01343123980c26e6d46 Mon Sep 17 00:00:00 2001
From: Meik Sievertsen
Date: Fri, 23 Feb 2007 13:50:27 +0000
Subject: - fixed some convertor bugs - adjusted forum standard access (+polls)
role to include f_delete (no update, only new installations will have the
change included)
git-svn-id: file:///svn/phpbb/trunk@7040 89ea8834-ac86-4346-8a33-228a782c2dd0
---
phpBB/install/convertors/convert_phpbb20.php | 19 ++++--
phpBB/install/convertors/functions_phpbb20.php | 89 +++++++++++++++++---------
phpBB/install/install_convert.php | 22 ++++---
phpBB/install/schemas/schema_data.sql | 4 +-
4 files changed, 89 insertions(+), 45 deletions(-)
(limited to 'phpBB/install')
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 4e159919ff..1cd03d3667 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -31,7 +31,7 @@ unset($dbpasswd);
*/
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
- 'version' => '0.9',
+ 'version' => '0.92',
'phpbb_version' => '3.0.0',
'author' => 'phpBB Group',
'dbms' => $dbms,
@@ -42,7 +42,7 @@ $convertor_data = array(
'dbname' => $dbname,
'table_prefix' => 'phpbb_',
'forum_path' => '../forums',
- 'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.',
+ 'author_notes' => '',
);
/**
@@ -206,13 +206,24 @@ if (!$get_info)
// If there is a user id 1, we need to increment user ids. :/
if ($user_id === 1)
{
- set_config('increment_user_id', 1, true);
+ // Try to get the maximum user id possible...
+ $sql = "SELECT MAX(user_id) AS max_user_id
+ FROM {$convert->src_table_prefix}users";
+ $result = $src_db->sql_query($sql);
+ $user_id = (int) $src_db->sql_fetchfield('max_user_id');
+ $src_db->sql_freeresult($result);
+
+ set_config('increment_user_id', ($user_id + 1), true);
}
else
{
set_config('increment_user_id', 0, true);
}
+ // Overwrite maximum avatar width/height
+ @define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
+ @define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
+
/**
* Description on how to use the convertor framework.
*
@@ -636,7 +647,7 @@ if (!$get_info)
array('enable_smilies', 'privmsgs.privmsgs_enable_smilies AS enable_smilies', ''),
array('enable_magic_url', 1, ''),
array('enable_sig', 'privmsgs.privmsgs_attach_sig', ''),
- array('message_subject', 'privmsgs.privmsgs_subject', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
+ array('message_subject', 'privmsgs.privmsgs_subject', 'phpbb_set_encoding'), // Already specialchared in 2.0.x
array('message_attachment', ((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
array('message_edit_reason', '', ''),
array('message_edit_user', 0, ''),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 2c53e5ccd1..598bb46a9a 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -456,6 +456,13 @@ function phpbb_user_id($user_id)
$id = (int) $src_db->sql_fetchfield('user_id');
$src_db->sql_freeresult($result);
+ // Try to get the maximum user id possible...
+ $sql = "SELECT MAX(user_id) AS max_user_id
+ FROM {$convert->src_table_prefix}users";
+ $result = $src_db->sql_query($sql);
+ $max_id = (int) $src_db->sql_fetchfield('max_user_id');
+ $src_db->sql_freeresult($result);
+
if ($convert->mysql_convert && $same_db)
{
$src_db->sql_query("SET NAMES 'utf8'");
@@ -464,8 +471,8 @@ function phpbb_user_id($user_id)
// If there is a user id 1, we need to increment user ids. :/
if ($id === 1)
{
- set_config('increment_user_id', 1, true);
- $config['increment_user_id'] = 1;
+ set_config('increment_user_id', ($max_id + 1), true);
+ $config['increment_user_id'] = $max_id + 1;
}
else
{
@@ -487,9 +494,9 @@ function phpbb_user_id($user_id)
return ANONYMOUS;
}
- if (!empty($config['increment_user_id']))
+ if (!empty($config['increment_user_id']) && $user_id == 1)
{
- $user_id++;
+ return $config['increment_user_id'];
}
return $user_id;
@@ -591,8 +598,8 @@ function phpbb_convert_authentication($mode)
// Add Forum Access List
$auth_map = array(
'auth_view' => array('f_', 'f_list'),
- 'auth_read' => 'f_read',
- 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_search', 'f_postcount'),
+ 'auth_read' => array('f_read', 'f_search'),
+ 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_postcount', 'f_report', 'f_subscribe', 'f_print', 'f_email'),
'auth_reply' => 'f_reply',
'auth_edit' => 'f_edit',
'auth_delete' => 'f_delete',
@@ -600,7 +607,7 @@ function phpbb_convert_authentication($mode)
'auth_vote' => 'f_vote',
'auth_announce' => 'f_announce',
'auth_sticky' => 'f_sticky',
- 'auth_attachments' => 'f_attach',
+ 'auth_attachments' => array('f_attach', 'f_download'),
'auth_download' => 'f_download',
);
@@ -705,18 +712,33 @@ function phpbb_convert_authentication($mode)
user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS, false);
// Selecting from old table
- $auth_sql = 'SELECT ';
- $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
- $auth_sql .= ', {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ if (!empty($config['increment_user_id']))
+ {
+ $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
+ user_group_auth('administrators', $auth_sql, true);
- user_group_auth('administrators', $auth_sql, true);
+ $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
+ user_group_auth('administrators', $auth_sql, true);
+ }
+ else
+ {
+ $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ user_group_auth('administrators', $auth_sql, true);
+ }
- // Put administrators into global moderators group too...
- $auth_sql = 'SELECT ';
- $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id';
- $auth_sql .= ', {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ if (!empty($config['increment_user_id']))
+ {
+ $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
+ user_group_auth('global_moderators', $auth_sql, true);
- user_group_auth('global_moderators', $auth_sql, true);
+ $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
+ user_group_auth('global_moderators', $auth_sql, true);
+ }
+ else
+ {
+ $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
+ user_group_auth('global_moderators', $auth_sql, true);
+ }
}
else if ($mode == 'first')
{
@@ -762,7 +784,7 @@ function phpbb_convert_authentication($mode)
// no break;
case 'registered_hidden':
- mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_LIMITED_POLLS');
+ mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_STANDARD_POLLS');
break;
case 'private':
@@ -980,25 +1002,32 @@ function phpbb_convert_authentication($mode)
if (sizeof($forum_ids))
{
// Now make sure the user is able to read these forums
- $hold_ary = $auth->acl_group_raw_data(get_group_id('guests'), 'f_list', $forum_ids);
+ $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids);
- if (!empty($hold_ary))
+ if (empty($hold_ary))
{
- mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ continue;
}
- else
+
+ foreach ($hold_ary as $g_id => $f_id_ary)
{
- // Now make sure the user is able to read these forums
- $hold_ary = $auth->acl_group_raw_data(get_group_id('registered'), 'f_list', $forum_ids);
+ $set_group = false;
+
+ foreach ($f_id_ary as $f_id => $auth_ary)
+ {
+ foreach ($auth_ary as $auth_option => $setting)
+ {
+ if ($setting == ACL_YES)
+ {
+ $set_group = true;
+ break 2;
+ }
+ }
+ }
- if (!empty($hold_ary))
+ if ($set_group)
{
- mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES);
- mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES);
+ mass_auth('group', $row['forum_id'], $g_id, 'f_list', ACL_YES);
}
}
}
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 54b8ee3a3d..49ce3689bd 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -141,7 +141,6 @@ class install_convert extends module
}
$db->sql_freeresult($result);
-
// Detect if there is already a conversion in progress at this point and offer to resume
// It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it
$new_conversion = request_var('new_conv', 0);
@@ -168,13 +167,13 @@ class install_convert extends module
// This information should have already been checked once, but do it again for safety
if (!empty($options) && !empty($options['tag']) &&
- isset($convert->options['dbms']) &&
- isset($convert->options['dbhost']) &&
- isset($convert->options['dbport']) &&
- isset($convert->options['dbuser']) &&
- isset($convert->options['dbpasswd']) &&
- isset($convert->options['dbname']) &&
- isset($convert->options['table_prefix']))
+ isset($options['dbms']) &&
+ isset($options['dbhost']) &&
+ isset($options['dbport']) &&
+ isset($options['dbuser']) &&
+ isset($options['dbpasswd']) &&
+ isset($options['dbname']) &&
+ isset($options['table_prefix']))
{
$this->page_title = $lang['CONTINUE_CONVERT'];
@@ -943,7 +942,12 @@ class install_convert extends module
'dbpasswd' => $convert->src_dbpasswd,
)), true);
- $msg = $user->lang['PRE_CONVERT_COMPLETE'] . '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
+ $msg = $user->lang['PRE_CONVERT_COMPLETE'];
+
+ if ($convert->convertor_data['author_notes'])
+ {
+ $msg .= '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
+ }
$url = $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convert->convertor_tag}$step";
$template->assign_vars(array(
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index d6703479a7..ef83d68c97 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -465,7 +465,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%';
# Standard Access (f_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock');
# No Access (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_';
@@ -484,7 +484,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
# Standard Access + Polls (f_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_sticky', 'f_user_lock');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_sticky', 'f_user_lock');
# Limited Access + Polls (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
--
cgit v1.2.1