aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-04-08 16:18:58 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-04-08 16:18:58 +0000
commit9066aae03f4f8b6e997416934e44b77dc119f088 (patch)
tree364dd466ce936c233776f8a42cb09fb9598586ba /phpBB/includes/functions_posting.php
parent1e908f078e17c8ae7bf5358da6d76aae4f51712a (diff)
downloadforums-9066aae03f4f8b6e997416934e44b77dc119f088.tar
forums-9066aae03f4f8b6e997416934e44b77dc119f088.tar.gz
forums-9066aae03f4f8b6e997416934e44b77dc119f088.tar.bz2
forums-9066aae03f4f8b6e997416934e44b77dc119f088.tar.xz
forums-9066aae03f4f8b6e997416934e44b77dc119f088.zip
Set topic_last_view_time on post/reply/edit to circumvent race conditions in auto prune and false removal of topics for manual forum prune (Bug #18055, #43515)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9426 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index e44454b5ff..9b7f8e001f 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1738,6 +1738,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[TOPICS_TABLE]['sql'] = array(
'topic_poster' => (int) $user->data['user_id'],
'topic_time' => $current_time,
+ 'topic_last_view_time' => $current_time,
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
'icon_id' => $data['icon_id'],
'topic_approved' => $post_approval,
@@ -1785,7 +1786,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
break;
case 'reply':
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies_real = topic_replies_real + 1, topic_bumped = 0, topic_bumper = 0' . (($post_approval) ? ', topic_replies = topic_replies + 1' : '') . ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
+ $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_view_time = ' . $current_time . ',
+ topic_replies_real = topic_replies_real + 1,
+ topic_bumped = 0,
+ topic_bumper = 0' .
+ (($post_approval) ? ', topic_replies = topic_replies + 1' : '') .
+ ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
+
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
if ($post_approval && $topic_type != POST_GLOBAL)
@@ -1824,6 +1831,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'poll_max_options' => (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1,
'poll_length' => (isset($poll['poll_options'])) ? $poll_length : 0,
'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0,
+ 'topic_last_view_time' => $current_time,
'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),
);
@@ -1867,7 +1875,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Correctly set back the topic replies and forum posts... but only if the post was approved before.
if (!$post_approval && $data['post_approved'])
{
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1';
+ $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time;
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
set_config_count('num_posts', -1, true);