aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2007-02-07 04:02:00 +0000
committerDavid M <davidmj@users.sourceforge.net>2007-02-07 04:02:00 +0000
commit0fc55efc7d887a07061b52456bfb01e0bc298d9a (patch)
tree4abcf950c5c63eedf3c968d7826ca5a42e940780
parent333b3515ed1e94dba1593b2eb3f9fb9d5a1f1440 (diff)
downloadforums-0fc55efc7d887a07061b52456bfb01e0bc298d9a.tar
forums-0fc55efc7d887a07061b52456bfb01e0bc298d9a.tar.gz
forums-0fc55efc7d887a07061b52456bfb01e0bc298d9a.tar.bz2
forums-0fc55efc7d887a07061b52456bfb01e0bc298d9a.tar.xz
forums-0fc55efc7d887a07061b52456bfb01e0bc298d9a.zip
#7698
- small UTF-8 thing git-svn-id: file:///svn/phpbb/trunk@6971 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/functions_convert.php2
-rw-r--r--phpBB/includes/utf/utf_tools.php6
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php4
-rw-r--r--phpBB/install/install_convert.php90
4 files changed, 96 insertions, 6 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 08ecd7c5e7..64cb63de3a 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1205,7 +1205,7 @@ function update_folder_pm_count()
$sql = 'SELECT user_id, folder_id, COUNT(msg_id) as num_messages
FROM ' . PRIVMSGS_TO_TABLE . '
WHERE folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ', ' . PRIVMSGS_INBOX . ', ' . PRIVMSGS_OUTBOX . ', ' . PRIVMSGS_SENTBOX . ')
- GROUP BY folder_id';
+ GROUP BY folder_id, user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php
index a13246c65d..9ab31e60e4 100644
--- a/phpBB/includes/utf/utf_tools.php
+++ b/phpBB/includes/utf/utf_tools.php
@@ -719,7 +719,7 @@ function utf8_recode($string, $encoding)
{
$ret = @iconv($encoding, 'utf-8', $string);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
@@ -730,7 +730,7 @@ function utf8_recode($string, $encoding)
{
$ret = @mb_convert_encoding($string, 'utf-8', $encoding);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
@@ -741,7 +741,7 @@ function utf8_recode($string, $encoding)
{
$ret = @recode_string($encoding . '..utf-8', $string);
- if (isset($ret[0]))
+ if (!empty($ret))
{
return $ret;
}
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 14d98deed2..7610c4725d 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -158,9 +158,9 @@ function phpbb_insert_forums()
}
// Now insert the forums
- $sql = 'SELECT f.*, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
+ $sql = 'SELECT f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
LEFT JOIN ' . $convert->src_table_prefix . 'forum_prune fp ON f.forum_id = fp.forum_id
- GROUP BY f.forum_id
+ GROUP BY f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, f.forum_order, fp.prune_days, fp.prune_freq
ORDER BY f.cat_id, f.forum_order';
if ($convert->mysql_convert)
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 0750bfa4f6..fbca8913c1 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -909,6 +909,51 @@ class install_convert extends module
$db->sql_query($query_first);
}
}
+
+ if ($db->sql_layer === 'postgres')
+ {
+ $tables = array(
+ ATTACHMENTS_TABLE => 'attach_id',
+ ACL_OPTIONS_TABLE => 'auth_option_id',
+ ACL_ROLES_TABLE => 'role_id',
+ BANLIST_TABLE => 'ban_id',
+ BOTS_TABLE => 'bot_id',
+ DISALLOW_TABLE => 'disallow_id',
+ DRAFTS_TABLE => 'draft_id',
+ EXTENSIONS_TABLE => 'extension_id',
+ EXTENSION_GROUPS_TABLE => 'group_id',
+ FORUMS_TABLE => 'forum_id',
+ GROUPS_TABLE => 'group_id',
+ ICONS_TABLE => 'icons_id',
+ LANG_TABLE => 'lang_id',
+ LOG_TABLE => 'log_id',
+ MODULES_TABLE => 'module_id',
+ POSTS_TABLE => 'post_id',
+ PRIVMSGS_TABLE => 'msg_id',
+ PRIVMSGS_FOLDER_TABLE => 'folder_id',
+ PRIVMSGS_RULES_TABLE => 'rule_id',
+ PROFILE_FIELDS_TABLE => 'field_id',
+ RANKS_TABLE => 'rank_id',
+ REPORTS_TABLE => 'report_id',
+ REPORTS_REASONS_TABLE => 'reason_id',
+ SEARCH_WORDLIST_TABLE => 'word_id',
+ SITELIST_TABLE => 'site_id',
+ SMILIES_TABLE => 'smiley_id',
+ STYLES_TABLE => 'style_id',
+ STYLES_TEMPLATE_TABLE => 'template_id',
+ STYLES_TEMPLATE_DATA_TABLE => 'template_id',
+ STYLES_THEME_TABLE => 'theme_id',
+ STYLES_IMAGESET_TABLE => 'imageset_id',
+ TOPICS_TABLE => 'topic_id',
+ USERS_TABLE => 'user_id',
+ WARNINGS_TABLE => 'warning_id',
+ WORDS_TABLE => 'word_id'
+ );
+ if (!empty($tables[$schema['target']]))
+ {
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ }
+ }
}
// Process execute_always for this table
@@ -1122,6 +1167,51 @@ class install_convert extends module
$waiting_rows = array();
}
+
+ if ($db->sql_layer === 'postgres')
+ {
+ $tables = array(
+ ATTACHMENTS_TABLE => 'attach_id',
+ ACL_OPTIONS_TABLE => 'auth_option_id',
+ ACL_ROLES_TABLE => 'role_id',
+ BANLIST_TABLE => 'ban_id',
+ BOTS_TABLE => 'bot_id',
+ DISALLOW_TABLE => 'disallow_id',
+ DRAFTS_TABLE => 'draft_id',
+ EXTENSIONS_TABLE => 'extension_id',
+ EXTENSION_GROUPS_TABLE => 'group_id',
+ FORUMS_TABLE => 'forum_id',
+ GROUPS_TABLE => 'group_id',
+ ICONS_TABLE => 'icons_id',
+ LANG_TABLE => 'lang_id',
+ LOG_TABLE => 'log_id',
+ MODULES_TABLE => 'module_id',
+ POSTS_TABLE => 'post_id',
+ PRIVMSGS_TABLE => 'msg_id',
+ PRIVMSGS_FOLDER_TABLE => 'folder_id',
+ PRIVMSGS_RULES_TABLE => 'rule_id',
+ PROFILE_FIELDS_TABLE => 'field_id',
+ RANKS_TABLE => 'rank_id',
+ REPORTS_TABLE => 'report_id',
+ REPORTS_REASONS_TABLE => 'reason_id',
+ SEARCH_WORDLIST_TABLE => 'word_id',
+ SITELIST_TABLE => 'site_id',
+ SMILIES_TABLE => 'smiley_id',
+ STYLES_TABLE => 'style_id',
+ STYLES_TEMPLATE_TABLE => 'template_id',
+ STYLES_TEMPLATE_DATA_TABLE => 'template_id',
+ STYLES_THEME_TABLE => 'theme_id',
+ STYLES_IMAGESET_TABLE => 'imageset_id',
+ TOPICS_TABLE => 'topic_id',
+ USERS_TABLE => 'user_id',
+ WARNINGS_TABLE => 'warning_id',
+ WORDS_TABLE => 'word_id'
+ );
+ if (!empty($tables[$schema['target']]))
+ {
+ $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $tables[$schema['target']] . ")>0 then max(" . $tables[$schema['target']] . ")+1 else 1 end from " . $schema['target'] . '));');
+ }
+ }
}
// When we reach this point, either the current table has been processed or we're running out of time.