Skip to content

Commit

Permalink
Add new function for printing conversion status (conv_processing_mess…
Browse files Browse the repository at this point in the history
…age)

Add wrapper for preparse_bbcode function
  • Loading branch information
daris committed Feb 2, 2012
1 parent f771633 commit ec12a55
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 154 deletions.
26 changes: 11 additions & 15 deletions forums/IP_Board_3_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function convert_bans()
'FROM' => 'banfilters',
)) or conv_error('Unable to fetch bans', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'bans', $this->db->num_rows($result));
conv_processing_message('bans', $this->db->num_rows($result));
while ($cur_ban = $this->db->fetch_assoc($result))
{
switch ($cur_ban['ban_type'])
Expand All @@ -80,7 +80,7 @@ function convert_categories()
'WHERE' => 'parent_id = -1',
)) or conv_error('Unable to fetch categories', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'categories', $this->db->num_rows($result));
conv_processing_message('categories', $this->db->num_rows($result));
while ($cur_cat = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('categories', $cur_cat);
Expand All @@ -94,7 +94,7 @@ function convert_censoring()
'FROM' => 'badwords',
)) or conv_error('Unable to fetch censoring', __FILE__, __LINE__, $this->db->error());

conv_message('Processing', 'censors', $this->db->num_rows($result));
conv_processing_message('censoring', $this->db->num_rows($result));
while ($cur_censor = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('censoring', $cur_censor);
Expand All @@ -111,7 +111,7 @@ function convert_config()
'FROM' => 'core_sys_conf_settings',
)) or conv_error('Unable to fetch config', __FILE__, __LINE__, $this->db->error());

conv_message('Processing', 'config');
conv_processing_message('config');
while ($cur_config = $this->db->fetch_assoc($result))
$old_config[$cur_config['conf_key']] = $cur_config['conf_value'];

Expand Down Expand Up @@ -214,7 +214,7 @@ function convert_forums()
'WHERE' => 'parent_id <> -1'
)) or conv_error('Unable to fetch forums', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forums', $this->db->num_rows($result));
conv_processing_message('forums', $this->db->num_rows($result));
while ($cur_forum = $this->db->fetch_assoc($result))
{
if ($cur_forum['num_topics'] == 0)
Expand Down Expand Up @@ -247,7 +247,7 @@ function convert_forums()
// 'FROM' => 'forum_perms',
// )) or conv_error('Unable to fetch forum perms', __FILE__, __LINE__, $this->db->error());

// conv_message('Processing num', 'forum_perms', $this->db->num_rows($result));
// conv_processing_message('forum_perms', $this->db->num_rows($result));
// while ($cur_perm = $this->db->fetch_assoc($result))
// {
// $cur_perm['group_id'] = $this->grp2grp($cur_perm['group_id']);
Expand All @@ -264,7 +264,7 @@ function convert_groups()
'WHERE' => 'g_id > 6',
)) or conv_error('Unable to fetch groups', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'groups', $this->db->num_rows($result));
conv_processing_message('groups', $this->db->num_rows($result));
while ($cur_group = $this->db->fetch_assoc($result))
{
$cur_group['g_id'] = $this->grp2grp($cur_group['g_id']);
Expand Down Expand Up @@ -308,7 +308,7 @@ function convert_ranks()
'FROM' => 'titles',
)) or conv_error('Unable to fetch ranks', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'ranks', $this->db->num_rows($result));
conv_processing_message('ranks', $this->db->num_rows($result));
while ($cur_rank = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('ranks', $cur_rank);
Expand All @@ -322,7 +322,7 @@ function convert_reports()
'FROM' => 'rc_reports',
)) or conv_error('Unable to fetch reports', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'reports', $this->db->num_rows($result));
conv_processing_message('reports', $this->db->num_rows($result));
while ($cur_report = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('reports', $cur_report);
Expand All @@ -336,7 +336,7 @@ function convert_reports()
// 'FROM' => 'subscriptions',
// )) or conv_error('Unable to fetch subscriptions', __FILE__, __LINE__, $this->db->error());

// conv_message('Processing num', 'subscriptions', $this->db->num_rows($result));
// conv_processing_message('subscriptions', $this->db->num_rows($result));
// while ($cur_sub = $this->db->fetch_assoc($result))
// {
// $this->fluxbb->add_row('topic_subscriptions', $cur_sub);
Expand Down Expand Up @@ -474,10 +474,6 @@ function uid2uid($id)
function convert_message($message)
{
static $patterns, $replacements;
global $re_list;

$errors = array();
require_once PUN_ROOT.'include/parser.php';

$message = html_entity_decode($message);

Expand All @@ -504,7 +500,7 @@ function convert_message($message)
);
}

return preparse_bbcode(str_replace(array_keys($replacements), array_values($replacements), $message), $errors);
return $this->fluxbb->preparse_bbcode(str_replace(array_keys($replacements), array_values($replacements), $message), $errors);
}

/**
Expand Down
20 changes: 10 additions & 10 deletions forums/Merge_FluxBB.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function convert_bans()
'FROM' => 'bans',
)) or conv_error('Unable to fetch bans', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'bans', $this->db->num_rows($result));
conv_processing_message('bans', $this->db->num_rows($result));
while ($cur_ban = $this->db->fetch_assoc($result))
{
$cur_ban['id'] += $this->last_id['bans'];
Expand All @@ -117,7 +117,7 @@ function convert_categories()
'FROM' => 'categories',
)) or conv_error('Unable to fetch categories', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'categories', $this->db->num_rows($result));
conv_processing_message('categories', $this->db->num_rows($result));
while ($cur_cat = $this->db->fetch_assoc($result))
{
$cur_cat['id'] += $this->last_id['categories'];
Expand All @@ -133,7 +133,7 @@ function convert_censoring()
'FROM' => 'censoring',
)) or conv_error('Unable to fetch censoring', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'censors', $this->db->num_rows($result));
conv_processing_message('censoring', $this->db->num_rows($result));
while ($cur_censor = $this->db->fetch_assoc($result))
{
$cur_censor['id'] += $this->last_id['censoring'];
Expand All @@ -153,7 +153,7 @@ function convert_forums()
'FROM' => 'forums',
)) or conv_error('Unable to fetch forums', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forums', $this->db->num_rows($result));
conv_processing_message('forums', $this->db->num_rows($result));
while ($cur_forum = $this->db->fetch_assoc($result))
{
$cur_forum['id'] += $this->last_id['forums'];
Expand All @@ -171,7 +171,7 @@ function convert_forum_perms()
'FROM' => 'forum_perms',
)) or conv_error('Unable to fetch forum perms', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forum_perms', $this->db->num_rows($result));
conv_processing_message('forum_perms', $this->db->num_rows($result));
while ($cur_perm = $this->db->fetch_assoc($result))
{
$cur_perm['group_id'] += $this->last_id['groups'];
Expand All @@ -189,7 +189,7 @@ function convert_groups()
'WHERE' => 'g_id > 4',
)) or conv_error('Unable to fetch groups', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'groups', $this->db->num_rows($result));
conv_processing_message('groups', $this->db->num_rows($result));
while ($cur_group = $this->db->fetch_assoc($result))
{
$cur_group['g_id'] += $this->last_id['groups'] - 4;
Expand Down Expand Up @@ -233,7 +233,7 @@ function convert_ranks()
'FROM' => 'ranks',
)) or conv_error('Unable to fetch ranks', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'ranks', $this->db->num_rows($result));
conv_processing_message('ranks', $this->db->num_rows($result));
while ($cur_rank = $this->db->fetch_assoc($result))
{
$cur_rank['id'] += $this->last_id['ranks'];
Expand All @@ -249,7 +249,7 @@ function convert_reports()
'FROM' => 'reports',
)) or conv_error('Unable to fetch reports', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'reports', $this->db->num_rows($result));
conv_processing_message('reports', $this->db->num_rows($result));
while ($cur_report = $this->db->fetch_assoc($result))
{
$cur_report['id'] += $this->last_id['reports'];
Expand All @@ -273,7 +273,7 @@ function convert_topic_subscriptions()
'FROM' => 'topic_subscriptions AS s',
)) or conv_error('Unable to fetch subscriptions', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'topic subscriptions', $this->db->num_rows($result));
conv_processing_message('topic subscriptions', $this->db->num_rows($result));
while ($cur_sub = $this->db->fetch_assoc($result))
{
$cur_sub['user_id'] = $this->fetchUid($cur_sub['username']);
Expand All @@ -298,7 +298,7 @@ function convert_forum_subscriptions()
'FROM' => 'forum_subscriptions AS s',
)) or conv_error('Unable to fetch subscriptions', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forum subscriptions', $this->db->num_rows($result));
conv_processing_message('forum subscriptions', $this->db->num_rows($result));
while ($cur_sub = $this->db->fetch_assoc($result))
{
$cur_sub['user_id'] = $this->fetchUid($cur_sub['username']);
Expand Down
22 changes: 11 additions & 11 deletions forums/MyBB_1.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function convert_bans()
'FROM' => 'banned AS b',
)) or conv_error('Unable to fetch bans', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'bans', $this->db->num_rows($result));
conv_processing_message('bans', $this->db->num_rows($result));
while ($cur_ban = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('bans', $cur_ban);
Expand All @@ -78,7 +78,7 @@ function convert_categories()
'WHERE' => 'type = \'c\'',
)) or conv_error('Unable to fetch categories', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'categories', $this->db->num_rows($result));
conv_processing_message('categories', $this->db->num_rows($result));
while ($cur_cat = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('categories', $cur_cat);
Expand All @@ -92,7 +92,7 @@ function convert_categories()
// 'FROM' => 'words',
// )) or conv_error('Unable to fetch words', __FILE__, __LINE__, $this->db->error());

// conv_message('Processing num', 'censors', $this->db->num_rows($result));
// conv_processing_message('censoring', $this->db->num_rows($result));
// while ($cur_censor = $this->db->fetch_assoc($result))
// {
// $this->fluxbb->add_row('censoring', $cur_censor);
Expand All @@ -108,7 +108,7 @@ function convert_config()
'FROM' => 'settings',
)) or conv_error('Unable to fetch config', __FILE__, __LINE__, $this->db->error());

conv_message('Processing', 'config');
conv_processing_message('config');
while ($cur_config = $this->db->fetch_assoc($result))
$old_config[$cur_config['name']] = $cur_config['value'];

Expand Down Expand Up @@ -211,7 +211,7 @@ function convert_forums()
'WHERE' => 'type = \'f\'',
)) or conv_error('Unable to fetch forums', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forums', $this->db->num_rows($result));
conv_processing_message('forums', $this->db->num_rows($result));
while ($cur_forum = $this->db->fetch_assoc($result))
{
if ($cur_forum['num_topics'] == 0)
Expand Down Expand Up @@ -239,7 +239,7 @@ function convert_forum_perms()
'FROM' => 'forumpermissions',
)) or conv_error('Unable to fetch forum perms', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forum_perms', $this->db->num_rows($result));
conv_processing_message('forum_perms', $this->db->num_rows($result));
while ($cur_perm = $this->db->fetch_assoc($result))
{
$cur_perm['group_id'] = $this->grp2grp($cur_perm['group_id']);
Expand All @@ -256,7 +256,7 @@ function convert_groups()
'WHERE' => 'gid > 7'
)) or conv_error('Unable to fetch groups', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'groups', $this->db->num_rows($result));
conv_processing_message('groups', $this->db->num_rows($result));
while ($cur_group = $this->db->fetch_assoc($result))
{
$cur_group['g_id'] = $this->grp2grp($cur_group['g_id']);
Expand Down Expand Up @@ -299,7 +299,7 @@ function convert_ranks()
'FROM' => 'usertitles',
)) or conv_error('Unable to fetch ranks', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'ranks', $this->db->num_rows($result));
conv_processing_message('ranks', $this->db->num_rows($result));
while ($cur_rank = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('ranks', $cur_rank);
Expand All @@ -313,7 +313,7 @@ function convert_reports()
'FROM' => 'reportedposts',
)) or conv_error('Unable to fetch reports', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'reports', $this->db->num_rows($result));
conv_processing_message('reports', $this->db->num_rows($result));
while ($cur_report = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('reports', $cur_report);
Expand All @@ -327,7 +327,7 @@ function convert_topic_subscriptions()
'FROM' => 'threadsubscriptions',
)) or conv_error('Unable to fetch topic subscriptions', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'topic subscriptions', $this->db->num_rows($result));
conv_processing_message('topic subscriptions', $this->db->num_rows($result));
while ($cur_sub = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('topic_subscriptions', $cur_sub);
Expand All @@ -341,7 +341,7 @@ function convert_forum_subscriptions()
'FROM' => 'forumsubscriptions',
)) or conv_error('Unable to fetch forum subscriptions', __FILE__, __LINE__, $this->db->error());

conv_message('Processing num', 'forum subscriptions', $this->db->num_rows($result));
conv_processing_message('forum subscriptions', $this->db->num_rows($result));
while ($cur_sub = $this->db->fetch_assoc($result))
{
$this->fluxbb->add_row('forum_subscriptions', $cur_sub);
Expand Down

0 comments on commit ec12a55

Please sign in to comment.