diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-08-01 15:29:47 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-08-01 15:29:47 +0000 |
commit | ced8624b8e86bc6aac143163e538f87376319079 (patch) | |
tree | 7479c2699efb9bd9c6785e0f5ecd4f792d8ca59e /phpBB/includes/functions_admin.php | |
parent | 541dbf8af07874e9507249a7e62cc3c32475d475 (diff) | |
download | forums-ced8624b8e86bc6aac143163e538f87376319079.tar forums-ced8624b8e86bc6aac143163e538f87376319079.tar.gz forums-ced8624b8e86bc6aac143163e538f87376319079.tar.bz2 forums-ced8624b8e86bc6aac143163e538f87376319079.tar.xz forums-ced8624b8e86bc6aac143163e538f87376319079.zip |
- fixing some bugs
- shortening some db columns to meet the requirements
- correctly increase/decrease user post counts
- fix the topic title length bug(s)
git-svn-id: file:///svn/phpbb/trunk@6224 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 11e2623167..a3b471a46e 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -563,9 +563,9 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = return false; } - $post_ids = $topic_ids = $forum_ids = array(); + $post_ids = $topic_ids = $forum_ids = $post_counts = array(); - $sql = 'SELECT post_id, poster_id, topic_id, forum_id + $sql = 'SELECT post_id, poster_id, post_postcount, topic_id, forum_id FROM ' . POSTS_TABLE . " WHERE $where_type " . ((!is_array($where_ids)) ? '= ' . (int) $where_ids : 'IN (' . implode(', ', array_map('intval', $where_ids)) . ')'); $result = $db->sql_query($sql); @@ -576,6 +576,11 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $poster_ids[] = $row['poster_id']; $topic_ids[] = $row['topic_id']; $forum_ids[] = $row['forum_id']; + + if ($row['post_postcount']) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } } $db->sql_freeresult($result); @@ -598,6 +603,18 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } unset($table_ary); + // 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); + } + } + // Remove the message from the search index $search_type = basename($config['search_type']); |