diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2006-09-01 13:16:22 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-09-01 13:16:22 +0000 |
| commit | 5f30881c2c11ffce73a75c3e5c18d1368e6777da (patch) | |
| tree | 8e26e09db8abc91b1027e7d2e5756429706200d1 /phpBB/includes/acp/acp_forums.php | |
| parent | 888bbf6ff4e465ff8f60a34f0859796fe4adc09d (diff) | |
| download | forums-5f30881c2c11ffce73a75c3e5c18d1368e6777da.tar forums-5f30881c2c11ffce73a75c3e5c18d1368e6777da.tar.gz forums-5f30881c2c11ffce73a75c3e5c18d1368e6777da.tar.bz2 forums-5f30881c2c11ffce73a75c3e5c18d1368e6777da.tar.xz forums-5f30881c2c11ffce73a75c3e5c18d1368e6777da.zip | |
fix some bugs - hopefully not breaking anything...
git-svn-id: file:///svn/phpbb/trunk@6342 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_forums.php')
| -rw-r--r-- | phpBB/includes/acp/acp_forums.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index e9e75ed57d..aad3306f3e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1315,6 +1315,20 @@ class acp_forums delete_attachments('topic', $topic_ids, false); + // Before we remove anything we make sure we are able to adjust the post counts later. ;) + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND post_postcount = 1'; + $result = $db->sql_query($sql); + + $post_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + $db->sql_freeresult($result); + switch (SQL_LAYER) { case 'mysql4': @@ -1416,6 +1430,18 @@ class acp_forums $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); } + // Adjust users post counts + if (sizeof($post_counts)) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id; + $db->sql_query($sql); + } + } + $db->sql_transaction('commit'); // Make sure the overall post/topic count is correct... |
