diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_convert.php | 21 | ||||
-rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 10 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 34 | ||||
-rw-r--r-- | phpBB/install/install_convert.php | 91 | ||||
-rwxr-xr-x | phpBB/language/en/install.php | 2 |
6 files changed, 159 insertions, 5 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c56fa29653..eaad188e45 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -194,6 +194,12 @@ p a { <li>[Fix] Imageset editor more friendly (Bug #11511)</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] 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] Filled "SMILIEYS_DISABLED" template variable (Bug #11257)</li> + <li>[Fix] Properly escaped the delimiter in disallowed username comparisons (Bug #11339)</li> + <li>[Fix] Check global purge setting (Bug #11555)</li> </ul> </div> diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 98c1452c23..5da10236c2 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1707,6 +1707,27 @@ function add_default_groups() } } + +/** +* Sync post count. We might need to do this in batches. +*/ +function sync_post_count($offset, $limit) +{ + global $db; + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_postcount = 1 + GROUP BY poster_id + ORDER BY poster_id'; + $result = $db->sql_query_limit($sql, $limit, $offset); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); +} + /** * Add the search bots into the database * This code should be used in execute_last if the source database did not have bots diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 246316513d..badac08999 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -83,6 +83,14 @@ function phpbb_insert_forums() $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON'); 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(); while ($row = $src_db->sql_fetchrow($result)) @@ -206,7 +214,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, diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 194bb5600a..9996d0ce96 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.RC1'; +$updates_to_version = '3.0.RC2'; if (defined('IN_PHPBB') && defined('IN_INSTALL')) { @@ -1151,6 +1151,38 @@ if (version_compare($current_version, '3.0.b5', '<=')) $no_updates = false; } +if (version_compare($current_version, '3.0.RC1', '<=')) +{ + // we have to remove a few extra entries from converted boards. + $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); + + $bots = array(); + $sql = 'SELECT u.user_id + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ug.group_id = ' . $bot_group_id . ' + AND ug.user_id = u.user_id'; + $result = $db->sql_query($sql); + + + while ($row = $db->sql_fetchrow($result)) + { + $bots[] = (int)$row['user_id']; + } + $db->sql_freeresult($result); + + if (sizeof($bots)) + { + $sql = 'DELETE FROM ' . USER_GROUP_TABLE . " + WHERE group_id <> $bot_group_id + AND " . $db->sql_in_set('user_id', $bots); + $db->sql_query($sql); + } +} _write_result($no_updates, $errored, $error_ary); diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index c0129e3c29..69ca75c9da 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -783,9 +783,17 @@ class install_convert extends module $jump = request_var('jump', 0); $final_jump = request_var('final_jump', 0); $sync_batch = request_var('sync_batch', -1); + $sync_post_count = request_var('sync_post_count', -1); $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... if ($sync_batch >= 0) { $this->sync_forums($sync_batch); @@ -1163,6 +1171,12 @@ class install_convert extends module $sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : ''; // Order By + + if (empty($schema['order_by']) && !empty($schema['primary'])) + { + $schema['order_by'] = $schema['primary']; + } + $sql .= (!empty($schema['order_by'])) ? "\nORDER BY " . $schema['order_by'] : ''; // Counting basically holds the amount of rows processed. @@ -1401,6 +1415,78 @@ class install_convert extends module /** * 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('&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('&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. + */ function sync_forums($sync_batch) { global $template, $user, $db, $phpbb_root_path, $phpEx, $config, $cache; @@ -1715,9 +1801,8 @@ class install_convert extends module 'RESULT' => $user->lang['DONE'], )); - // Continue with synchronizing the forums... - $url = $this->save_convert_progress('&sync_batch=0'); - + // Continue with synchronizing the post counts... + $url = $this->save_convert_progress('&sync_post_count=0'); $template->assign_vars(array( 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], 'U_ACTION' => $url, diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index fa176cbaea..32a66ba62b 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -330,6 +330,8 @@ $lang = array_merge($lang, array( // TODO: Write some text on obtaining support 'SUPPORT_BODY' => 'During the release candidate phase full support will be given at <a href="http://www.phpbb.com/community/viewforum.php?f=46">the phpBB 3.0.x support forums</a>. We will provide answers to general setup questions, configuration problems, conversion problems and support for determining common problems mostly related to bugs. We also allow discussions about modifications and custom code/style additions.</p><p>For additional assistance, please refer to our <a href="http://www.phpbb.com/support/documentation/3.0/quickstart/">Quick Start Guide</a> and <a href="http://www.phpbb.com/support/documentation/3.0/">the online documentation</a>.</p><p>To ensure you stay up to date with the latest news and releases, why not <a href="http://www.phpbb.com/support/">subscribe to our mailing list</a>?', 'SYNC_FORUMS' => 'Starting to sync forums', + 'SYNC_POST_COUNT' => 'Synchronising post_counts', + 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from <var>entry</var> %1$s to %2$s.', 'SYNC_TOPICS' => 'Starting to sync topics', 'SYNC_TOPIC_ID' => 'Synchronising topics from <var>topic_id</var> %1$s to %2$s.', |