aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-10-23 15:30:52 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-10-23 16:59:33 +0200
commit43e6b3a921d45150cd5c2a931e3e14758081f321 (patch)
treee4c18a4bcb71ad024e0b072b1dcc8ba0e0aa15ea
parentfec72c4b782cda044b9a05122530f3a32213b407 (diff)
downloadforums-43e6b3a921d45150cd5c2a931e3e14758081f321.tar
forums-43e6b3a921d45150cd5c2a931e3e14758081f321.tar.gz
forums-43e6b3a921d45150cd5c2a931e3e14758081f321.tar.bz2
forums-43e6b3a921d45150cd5c2a931e3e14758081f321.tar.xz
forums-43e6b3a921d45150cd5c2a931e3e14758081f321.zip
[feature/soft-delete] Fix some more topic/post count handling
Only disapproving in queue is missing. PHPBB3-9567
-rw-r--r--phpBB/includes/functions_posting.php3
-rw-r--r--phpBB/includes/mcp/mcp_main.php22
-rw-r--r--phpBB/includes/mcp/mcp_queue.php2
-rw-r--r--phpBB/viewforum.php2
4 files changed, 9 insertions, 20 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 7962690ca8..473149a8ec 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1491,8 +1491,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
// counting is fun! we only have to do sizeof($forum_ids) number of queries,
// even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
$sql = 'UPDATE ' . FORUMS_TABLE . '
- SET forum_topics_real = forum_topics_real - ' . $topic_count . ',
- forum_topics = forum_topics - ' . $topic_count . '
+ SET forum_topics = forum_topics - ' . $topic_count . '
WHERE forum_id = ' . $updated_forum;
$db->sql_query($sql);
update_post_information('forum', $updated_forum);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 6245a1b32b..99b23e9db1 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -1097,23 +1097,15 @@ function mcp_fork_topic($topic_ids)
}
// Sync new topics, parent forums and board stats
- sync('topic', 'topic_id', $new_topic_id_list);
-
- $sync_sql = array();
-
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $total_posts;
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . sizeof($new_topic_id_list);
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . sizeof($new_topic_id_list);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- $db->sql_query($sql);
- }
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET forum_posts = forum_posts + ' . $total_posts . ',
+ forum_topics = forum_topics + ' . sizeof($new_topic_id_list) . '
+ WHERE forum_id = ' . $to_forum_id;
+ $db->sql_query($sql);
+ sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
+
set_config_count('num_topics', sizeof($new_topic_id_list), true);
set_config_count('num_posts', $total_posts, true);
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 3d36229ee7..c954edacb2 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -895,7 +895,7 @@ class mcp_queue
$disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
$topic_replies_real = $post_disapprove_list = array();
- // Build a list of posts to be unapproved and get the related topics real replies count
+ // Build a list of posts to be disapproved and get the related topics real replies count
foreach ($post_info as $post_id => $post_data)
{
$post_disapprove_list[$post_id] = $post_data['topic_id'];
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index c3ab530673..501acbed14 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -229,8 +229,6 @@ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
// Limit topics to certain time frame, obtain correct topic count
-// global announcements must not be counted, normal announcements have to
-// be counted, as forum_topics(_real) includes them
if ($sort_days)
{
$min_post_time = time() - ($sort_days * 86400);