diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-04-11 11:10:07 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-04-11 11:10:07 +0000 |
commit | 77fcc367e2ec60a1ca9a891d6cbcbf48be05badb (patch) | |
tree | aae9bd37f0ef32a2f4d7b472f82db6e679e52a94 /phpBB/includes/functions_admin.php | |
parent | 4d9b106db2ccc6e15b4afd3fc2e69cf37fae81cf (diff) | |
download | forums-77fcc367e2ec60a1ca9a891d6cbcbf48be05badb.tar forums-77fcc367e2ec60a1ca9a891d6cbcbf48be05badb.tar.gz forums-77fcc367e2ec60a1ca9a891d6cbcbf48be05badb.tar.bz2 forums-77fcc367e2ec60a1ca9a891d6cbcbf48be05badb.tar.xz forums-77fcc367e2ec60a1ca9a891d6cbcbf48be05badb.zip |
SQL optimizations
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9439 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 549f854b78..7aaff2a562 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -652,7 +652,21 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = return false; } - $where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids)); + $where_ids = array_map('intval', $where_ids); + +/* Possible code for splitting post deletion + if (sizeof($where_ids) >= 1001) + { + // Split into chunks of 1000 + $chunks = array_chunk($where_ids, 1000); + + foreach ($chunks as $_where_ids) + { + delete_posts($where_type, $_where_ids, $auto_sync, $posted_sync, $post_count_sync, $call_delete_topics); + } + }*/ + + $where_clause = $db->sql_in_set($where_type, $where_ids); } $approved_posts = 0; @@ -665,10 +679,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = while ($row = $db->sql_fetchrow($result)) { - $post_ids[] = $row['post_id']; - $poster_ids[] = $row['poster_id']; - $topic_ids[] = $row['topic_id']; - $forum_ids[] = $row['forum_id']; + $post_ids[] = (int) $row['post_id']; + $poster_ids[] = (int) $row['poster_id']; + $topic_ids[] = (int) $row['topic_id']; + $forum_ids[] = (int) $row['forum_id']; if ($row['post_postcount'] && $post_count_sync && $row['post_approved']) { |