mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 20:13:22 +01:00
[feature/soft-delete] Fix some more topic/post count handling
Only disapproving in queue is missing. PHPBB3-9567
This commit is contained in:
parent
fec72c4b78
commit
43e6b3a921
@ -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);
|
||||
|
@ -1097,23 +1097,15 @@ function mcp_fork_topic($topic_ids)
|
||||
}
|
||||
|
||||
// Sync new topics, parent forums and board stats
|
||||
$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_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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -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'];
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user