aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-04-18 15:09:19 +0000
commit1042152a55ab2d0764c446949a77f085ab7a77f3 (patch)
tree008dc317ce03e80988c8c79f8c6d0cf263a02b32 /phpBB/includes/functions_admin.php
parente3d98fe77b1f2c60ceefa0ddf9091d08815d1f89 (diff)
downloadforums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.gz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.bz2
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.tar.xz
forums-1042152a55ab2d0764c446949a77f085ab7a77f3.zip
Merge changes made in revisions #r9405 to #r9467
2009-04-18 git-svn-id: file:///svn/phpbb/trunk@9468 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php27
1 files changed, 22 insertions, 5 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index ead47e4dba..884c5526c4 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -633,7 +633,24 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
return false;
}
- $where_clause = phpbb::$db->sql_in_set($where_type, array_map('intval', $where_ids));
+ $where_ids = array_map('intval', $where_ids);
+
+ // Split post deletion into chunks to overcome database limitations
+ if (sizeof($where_ids) >= 1001)
+ {
+ // Split into chunks of 1000
+ $chunks = array_chunk($where_ids, 1000);
+ $removed_posts = 0;
+
+ foreach ($chunks as $_where_ids)
+ {
+ $removed_posts += delete_posts($where_type, $_where_ids, $auto_sync, $posted_sync, $post_count_sync, $call_delete_topics);
+ }
+
+ return $removed_posts;
+ }
+
+ $where_clause = phpbb::$db->sql_in_set($where_type, $where_ids);
}
$approved_posts = 0;
@@ -646,10 +663,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
while ($row = phpbb::$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'])
{