aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/convertors
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:05:35 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:05:35 +0100
commit0e0c8d78199cfa2dd56a62266df33655c93367ff (patch)
tree757d55e62f00042a60d3988ce7b09588a749bf45 /phpBB/install/convertors
parentbae824e818fb30260385ed63e6fbea2779a3d19a (diff)
parent4319ebbaf6d029bdbb1a9bc6c33c66e62cd486a2 (diff)
downloadforums-0e0c8d78199cfa2dd56a62266df33655c93367ff.tar
forums-0e0c8d78199cfa2dd56a62266df33655c93367ff.tar.gz
forums-0e0c8d78199cfa2dd56a62266df33655c93367ff.tar.bz2
forums-0e0c8d78199cfa2dd56a62266df33655c93367ff.tar.xz
forums-0e0c8d78199cfa2dd56a62266df33655c93367ff.zip
Merge commit 'release-3.0-RC2'
Diffstat (limited to 'phpBB/install/convertors')
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php43
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php50
2 files changed, 68 insertions, 25 deletions
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 14ad45004d..796c2e19d4 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.92',
+ 'version' => '1.0.RC2',
'phpbb_version' => '3.0.0',
'author' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
'dbms' => $dbms,
@@ -184,8 +184,14 @@ if (!$get_info)
'extensions',
'extension_groups'
);
+
+ $src_db->sql_freeresult($result);
}
- $src_db->sql_freeresult($result);
+ else if ($result)
+ {
+ $src_db->sql_freeresult($result);
+ }
+
/**
* Tests for further MODs can be included here.
@@ -540,9 +546,7 @@ if (!$get_info)
array('smiley_width', 'smilies.smile_url', 'get_smiley_width'),
array('smiley_height', 'smilies.smile_url', 'get_smiley_height'),
array('smiley_order', 'smilies.smilies_id', ''),
- array('display_on_posting', 'smilies.smilies_id', array(
- 'execute' => '{RESULT} = ({VALUE}[0] <= 20) ? 1 : 0;',
- )),
+ array('display_on_posting', 'smilies.smilies_id', 'get_smiley_display'),
'order_by' => 'smilies.smilies_id ASC',
),
@@ -702,7 +706,8 @@ if (!$get_info)
array('pm_forwarded', 0, ''),
array('folder_id', PRIVMSGS_INBOX, ''),
- 'where' => 'privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5',
+ 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
+ AND (privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
),
// Outbox
@@ -714,14 +719,15 @@ if (!$get_info)
array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
array('pm_deleted', 0, ''),
- array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
- array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
+ array('pm_new', 0, ''),
+ array('pm_unread', 0, ''),
array('pm_replied', 0, ''),
array('pm_marked', 0, ''),
array('pm_forwarded', 0, ''),
array('folder_id', PRIVMSGS_OUTBOX, ''),
- 'where' => 'privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5',
+ 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
+ AND (privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
),
// Sentbox
@@ -740,7 +746,8 @@ if (!$get_info)
array('pm_forwarded', 0, ''),
array('folder_id', PRIVMSGS_SENTBOX, ''),
- 'where' => 'privmsgs.privmsgs_type = 2',
+ 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
+ AND privmsgs.privmsgs_type = 2',
),
// Savebox (SAVED IN)
@@ -759,7 +766,8 @@ if (!$get_info)
array('pm_forwarded', 0, ''),
array('folder_id', 'privmsgs.privmsgs_to_userid', 'phpbb_get_savebox_id'),
- 'where' => 'privmsgs.privmsgs_type = 3',
+ 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
+ AND privmsgs.privmsgs_type = 3',
),
// Savebox (SAVED OUT)
@@ -778,7 +786,8 @@ if (!$get_info)
array('pm_forwarded', 0, ''),
array('folder_id', 'privmsgs.privmsgs_from_userid', 'phpbb_get_savebox_id'),
- 'where' => 'privmsgs.privmsgs_type = 4',
+ 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
+ AND privmsgs.privmsgs_type = 4',
),
array(
@@ -853,7 +862,7 @@ if (!$get_info)
array('user_lang', $config['default_lang'], ''),
array('', 'users.user_lang', ''),
array('user_timezone', 'users.user_timezone', ''),
- array('user_dateformat', 'users.user_dateformat', ''),
+ array('user_dateformat', 'users.user_dateformat', array('function1' => 'phpbb_set_encoding')),
array('user_inactive_reason', '', 'phpbb_inactive_reason'),
array('user_inactive_time', '', 'phpbb_inactive_time'),
@@ -861,10 +870,10 @@ if (!$get_info)
array('user_occ', 'users.user_occ', array('function1' => 'phpbb_set_encoding')),
array('user_website', 'users.user_website', 'validate_website'),
array('user_jabber', '', ''),
- array('user_msnm', 'users.user_msnm', ''),
- array('user_yim', 'users.user_yim', ''),
- array('user_aim', 'users.user_aim', ''),
- array('user_icq', 'users.user_icq', ''),
+ array('user_msnm', 'users.user_msnm', array('function1' => 'phpbb_set_encoding')),
+ array('user_yim', 'users.user_yim', array('function1' => 'phpbb_set_encoding')),
+ array('user_aim', 'users.user_aim', array('function1' => 'phpbb_set_encoding')),
+ array('user_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')),
array('user_from', 'users.user_from', array('function1' => 'phpbb_set_encoding')),
array('user_rank', 'users.user_rank', ''),
array('user_permissions', '', ''),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 6788ecd900..eca72b64bd 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -59,6 +59,15 @@ function phpbb_insert_forums()
$max_forum_id++;
+ // pruning disabled globally?
+ $sql = "SELECT config_value
+ FROM {$convert->src_table_prefix}config
+ WHERE config_name = 'prune_enable'";
+ $result = $src_db->sql_query($sql);
+ $prune_enabled = (int) $src_db->sql_fetchfield('config_value');
+ $src_db->sql_freeresult($result);
+
+
// Insert categories
$sql = 'SELECT cat_id, cat_title
FROM ' . $convert->src_table_prefix . 'categories
@@ -206,7 +215,7 @@ function phpbb_insert_forums()
'forum_desc' => htmlspecialchars(phpbb_set_default_encoding($row['forum_desc']), ENT_COMPAT, 'UTF-8'),
'forum_type' => FORUM_POST,
'forum_status' => is_item_locked($row['forum_status']),
- 'enable_prune' => $row['prune_enable'],
+ 'enable_prune' => ($prune_enabled) ? $row['prune_enable'] : 0,
'prune_next' => null_to_zero($row['prune_next']),
'prune_days' => null_to_zero($row['prune_days']),
'prune_viewed' => 0,
@@ -270,10 +279,28 @@ function phpbb_insert_forums()
switch ($db->sql_layer)
{
+ case 'postgres':
+ $db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));');
+ break;
+
case 'mssql':
case 'mssql_odbc':
$db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' OFF');
break;
+
+ case 'oracle':
+ $result = $db->sql_query('SELECT MAX(forum_id) as max_id FROM ' . FORUMS_TABLE);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $largest_id = (int) $row['max_id'];
+
+ if ($largest_id)
+ {
+ $db->sql_query('DROP SEQUENCE ' . FORUMS_TABLE . '_seq');
+ $db->sql_query('CREATE SEQUENCE ' . FORUMS_TABLE . '_seq START WITH ' . ($largest_id + 1));
+ }
+ break;
}
}
@@ -536,7 +563,6 @@ function phpbb_convert_authentication($mode)
while ($row = $src_db->sql_fetchrow($result))
{
$user_id = (int) phpbb_user_id($row['user_id']);
-
// Set founder admin...
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_type = ' . USER_FOUNDER . "
@@ -544,6 +570,13 @@ function phpbb_convert_authentication($mode)
$db->sql_query($sql);
}
$src_db->sql_freeresult($result);
+
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = '" . $db->sql_escape('BOTS') . "'";
+ $result = $db->sql_query($sql);
+ $bot_group_id = (int) $db->sql_fetchfield('group_id');
+ $db->sql_freeresult($result);
}
// Grab forum auth information
@@ -564,10 +597,11 @@ function phpbb_convert_authentication($mode)
}
// Grab user auth information from 2.0.x board
$sql = "SELECT ug.user_id, aa.*
- FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}user_group ug, {$convert->src_table_prefix}groups g
+ FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}user_group ug, {$convert->src_table_prefix}groups g, {$convert->src_table_prefix}forums f
WHERE g.group_id = aa.group_id
AND g.group_single_user = 1
- AND ug.group_id = g.group_id";
+ AND ug.group_id = g.group_id
+ AND f.forum_id = aa.forum_id";
$result = $src_db->sql_query($sql);
$user_access = array();
@@ -710,7 +744,7 @@ function phpbb_convert_authentication($mode)
if ($mode == 'start')
{
user_group_auth('guests', 'SELECT user_id, {GUESTS} FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS, false);
- user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS, false);
+ user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS . " AND group_id <> $bot_group_id", false);
// Selecting from old table
if (!empty($config['increment_user_id']))
@@ -1693,7 +1727,7 @@ function phpbb_check_username_collisions()
break;
case 'oracle':
- $create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv
+ $create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv (
user_id number(8) NOT NULL,
username_clean varchar2(255) DEFAULT \'\'
)';
@@ -1709,15 +1743,15 @@ function phpbb_check_username_collisions()
case 'sqlite':
$create_sql = 'CREATE TABLE ' . $table_prefix . 'userconv (
user_id INTEGER NOT NULL DEFAULT \'0\',
- username_clean varchar(255) NOT NULL DEFAULT \'\',
+ username_clean varchar(255) NOT NULL DEFAULT \'\'
)';
break;
}
$db->sql_return_on_error(true);
$db->sql_query($drop_sql);
- $db->sql_query($create_sql);
$db->sql_return_on_error(false);
+ $db->sql_query($create_sql);
// now select all user_ids and usernames and then convert the username (this can take quite a while!)
$sql = 'SELECT user_id, username