undoing the fix for #11421 - correcting post counts was not well liked.

#11665


git-svn-id: file:///svn/phpbb/trunk@7674 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2007-05-25 09:34:05 +00:00
parent bd2f26a186
commit e45c503bde
3 changed files with 13 additions and 92 deletions

View file

@ -196,7 +196,6 @@ p a {
<li>[Fix] Made Custom BBCode validation more strict (Bug #11335)</li> <li>[Fix] Made Custom BBCode validation more strict (Bug #11335)</li>
<li>[Fix] Proper sync of data on topic copy (Bug #11335)</li> <li>[Fix] Proper sync of data on topic copy (Bug #11335)</li>
<li>[Fix] Introduced ORDER BY clauses to converter queries (Bug #10697)</li> <li>[Fix] Introduced ORDER BY clauses to converter queries (Bug #10697)</li>
<li>[Fix] added a sync to post counts during conversion (Bug #11421)</li>
<li>[Fix] Stopped bots from getting added to the registered users group during conversion (Bug #11283)</li> <li>[Fix] Stopped bots from getting added to the registered users group during conversion (Bug #11283)</li>
<li>[Fix] Filled "SMILIEYS_DISABLED" template variable (Bug #11257)</li> <li>[Fix] Filled "SMILIEYS_DISABLED" template variable (Bug #11257)</li>
<li>[Fix] Properly escaped the delimiter in disallowed username comparisons (Bug #11339)</li> <li>[Fix] Properly escaped the delimiter in disallowed username comparisons (Bug #11339)</li>

View file

@ -59,6 +59,15 @@ function phpbb_insert_forums()
$max_forum_id++; $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 // Insert categories
$sql = 'SELECT cat_id, cat_title $sql = 'SELECT cat_id, cat_title
FROM ' . $convert->src_table_prefix . 'categories FROM ' . $convert->src_table_prefix . 'categories
@ -84,13 +93,7 @@ function phpbb_insert_forums()
break; break;
} }
// 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);
$cats_added = array(); $cats_added = array();
while ($row = $src_db->sql_fetchrow($result)) while ($row = $src_db->sql_fetchrow($result))

View file

@ -783,16 +783,8 @@ class install_convert extends module
$jump = request_var('jump', 0); $jump = request_var('jump', 0);
$final_jump = request_var('final_jump', 0); $final_jump = request_var('final_jump', 0);
$sync_batch = request_var('sync_batch', -1); $sync_batch = request_var('sync_batch', -1);
$sync_post_count = request_var('sync_post_count', -1);
$last_statement = request_var('last', 0); $last_statement = request_var('last', 0);
// We are running sync...
if ($sync_post_count >= 0)
{
$this->sync_user_posts($sync_post_count);
return;
}
// We are running sync... // We are running sync...
if ($sync_batch >= 0) if ($sync_batch >= 0)
{ {
@ -1171,12 +1163,10 @@ class install_convert extends module
$sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : ''; $sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : '';
// Order By // Order By
if (empty($schema['order_by']) && !empty($schema['primary'])) if (empty($schema['order_by']) && !empty($schema['primary']))
{ {
$schema['order_by'] = $schema['primary']; $schema['order_by'] = $schema['primary'];
} }
$sql .= (!empty($schema['order_by'])) ? "\nORDER BY " . $schema['order_by'] : ''; $sql .= (!empty($schema['order_by'])) ? "\nORDER BY " . $schema['order_by'] : '';
// Counting basically holds the amount of rows processed. // Counting basically holds the amount of rows processed.
@ -1412,78 +1402,6 @@ class install_convert extends module
return; return;
} }
/**
* Sync function being executed at the middle, some functions need to be executed after a successful sync.
*/
function sync_user_posts($sync_batch)
{
global $db, $template, $user;
global $convert;
$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
'LEGEND' => $user->lang['SYNC_POST_COUNT'],
));
$batch_size = $convert->batch_size;
$sql = 'SELECT COUNT(user_id) AS max_value
FROM ' . USERS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Set values of minimum/maximum primary value for this table.
$primary_min = 0;
$primary_max = $row['max_value'];
if ($sync_batch == 1)
{
$sync_batch = (int) $primary_min;
}
// Fetch a batch of rows, process and insert them.
while ($sync_batch <= $primary_max && still_on_time())
{
$end = ($sync_batch + $batch_size - 1);
$template->assign_block_vars('checks', array(
'TITLE' => sprintf($user->lang['SYNC_POST_COUNT_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG_EXTRA') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' KB]' : ''),
'RESULT' => $user->lang['DONE'],
));
$sync_batch += $batch_size;
}
if ($sync_batch >= $primary_max)
{
sync_post_count($sync_batch, $batch_size);
$url = $this->save_convert_progress('&amp;sync_batch=0');
$template->assign_vars(array(
'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
'U_ACTION' => $url,
));
$this->meta_refresh($url);
return;
}
else
{
$sync_batch--;
}
$url = $this->save_convert_progress('&amp;sync_post_count=' . $sync_batch);
$template->assign_vars(array(
'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
'U_ACTION' => $url,
));
$this->meta_refresh($url);
return;
}
/** /**
* Sync function being executed at the middle, some functions need to be executed after a successful sync. * Sync function being executed at the middle, some functions need to be executed after a successful sync.
*/ */
@ -1801,8 +1719,9 @@ class install_convert extends module
'RESULT' => $user->lang['DONE'], 'RESULT' => $user->lang['DONE'],
)); ));
// Continue with synchronizing the post counts... // Continue with synchronizing the forums...
$url = $this->save_convert_progress('&amp;sync_post_count=0'); $url = $this->save_convert_progress('&amp;sync_batch=0');
$template->assign_vars(array( $template->assign_vars(array(
'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
'U_ACTION' => $url, 'U_ACTION' => $url,