diff --git a/phpBB/upgrade.php b/phpBB/upgrade.php
index b98178e9aa..d9efa94e3c 100644
--- a/phpBB/upgrade.php
+++ b/phpBB/upgrade.php
@@ -812,24 +812,16 @@ if ( !empty($next) )
$per_pct = ceil( $db->sql_numrows($result) / 40 );
$inc = 0;
+ $group_id = 1;
while( $row = $db->sql_fetchrow($result) )
{
- $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user)
- VALUES ('" . addslashes($row['username']) . "', 'Personal User', 1)";
+ $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user)
+ VALUES ($group_id, '" . addslashes($row['username']) . "', 'Personal User', 1)";
query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".GROUPS_TABLE);
- $group_id = $db->sql_nextid();
-
- if ( $group_id != 0 )
- {
- $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
- VALUES ($group_id, " . $row['user_id'] . ", 0)";
- query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".USER_GROUP_TABLE);
- }
- else
- {
- print "Couldn't get insert ID for " . GROUPS_TABLE . " table
\n";
- }
+ $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
+ VALUES ($group_id, " . $row['user_id'] . ", 0)";
+ query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".USER_GROUP_TABLE);
if ( is_int($row['user_regdate']) )
{
@@ -837,6 +829,8 @@ if ( !empty($next) )
continue;
}
+ $group_id++;
+
//
// Nathan's bbcode2 conversion
//
@@ -1630,77 +1624,6 @@ if ( !empty($next) )
}
print " OK
\n";
- end_step('fulltext_search_indexing');
-
- case 'fulltext_search_indexing':
- //
- // Generate search word list
- //
- // Fetch a batch of posts_text entries
- //
- $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
- FROM " . POSTS_TEXT_TABLE;
- $result = query($sql, "Couldn't get post count totals");
-
- $max_post_id = $db->sql_fetchrow($result);
-
- $totalposts = $max_post_id['total'];
- $max_post_id = $max_post_id['max_post_id'];
- $per_percent = round(( $totalposts / 500 ) * 10);
-
- $postcounter = ( !isset($HTTP_GET_VARS['batchstart']) ) ? 0 : $HTTP_GET_VARS['batchstart'];
-
- $batchsize = 150; // Process this many posts per loop
- $batchcount = 0;
- $total_percent = 0;
-
- for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
- {
- $batchstart = $postcounter + 1;
- $batchend = $postcounter + $batchsize;
- $batchcount++;
-
- print " * Fulltext Indexing ( $batchstart to $batchend ) :: ";
- flush();
-
- $sql = "SELECT *
- FROM " . POSTS_TEXT_TABLE ."
- WHERE post_id
- BETWEEN $batchstart
- AND $batchend";
- $posts_result = query($sql, "Couldn't obtain post_text");
-
- $per_pct = ceil( $db->sql_numrows($posts_result) / 40 );
- $inc = 0;
-
- if ( $row = $db->sql_fetchrow($posts_result) )
- {
- do
- {
- add_search_words($row['post_id'], $row['post_text'], $row['post_subject']);
-
- $inc++;
- if ( $inc == $per_pct )
- {
- print ".";
- flush();
- $inc = 0;
- }
- }
- while( $row = $db->sql_fetchrow($posts_result) );
- }
-
- $db->sql_freeresult($posts_result);
-
- // Remove common words after the first 2 batches and after every 4th batch after that.
- if ( $batchcount % 4 == 3 )
- {
- remove_common('global', 0.4);
- }
-
- print " OK
\n";
- }
-
end_step('update_topics');
case 'update_topics':
@@ -1930,6 +1853,77 @@ if ( !empty($next) )
print "OK
\n";
}
+ end_step('fulltext_search_indexing');
+
+ case 'fulltext_search_indexing':
+ //
+ // Generate search word list
+ //
+ // Fetch a batch of posts_text entries
+ //
+ $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
+ FROM " . POSTS_TEXT_TABLE;
+ $result = query($sql, "Couldn't get post count totals");
+
+ $max_post_id = $db->sql_fetchrow($result);
+
+ $totalposts = $max_post_id['total'];
+ $max_post_id = $max_post_id['max_post_id'];
+ $per_percent = round(( $totalposts / 500 ) * 10);
+
+ $postcounter = ( !isset($HTTP_GET_VARS['batchstart']) ) ? 0 : $HTTP_GET_VARS['batchstart'];
+
+ $batchsize = 150; // Process this many posts per loop
+ $batchcount = 0;
+ $total_percent = 0;
+
+ for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
+ {
+ $batchstart = $postcounter + 1;
+ $batchend = $postcounter + $batchsize;
+ $batchcount++;
+
+ print " * Fulltext Indexing ( $batchstart to $batchend ) :: ";
+ flush();
+
+ $sql = "SELECT *
+ FROM " . POSTS_TEXT_TABLE ."
+ WHERE post_id
+ BETWEEN $batchstart
+ AND $batchend";
+ $posts_result = query($sql, "Couldn't obtain post_text");
+
+ $per_pct = ceil( $db->sql_numrows($posts_result) / 40 );
+ $inc = 0;
+
+ if ( $row = $db->sql_fetchrow($posts_result) )
+ {
+ do
+ {
+ add_search_words($row['post_id'], $row['post_text'], $row['post_subject']);
+
+ $inc++;
+ if ( $inc == $per_pct )
+ {
+ print ".";
+ flush();
+ $inc = 0;
+ }
+ }
+ while( $row = $db->sql_fetchrow($posts_result) );
+ }
+
+ $db->sql_freeresult($posts_result);
+
+ // Remove common words after the first 2 batches and after every 4th batch after that.
+ if ( $batchcount % 4 == 3 )
+ {
+ remove_common('global', 0.4);
+ }
+
+ print " OK
\n";
+ }
+
echo "\n
\n\nUPGRADE COMPLETED
\n";
}
}
@@ -1938,4 +1932,4 @@ print "
If the upgrade completed without error you may click
+?>
\ No newline at end of file