Skip to content

Commit 99e6bb8

Browse files
authored
Merge pull request #949 from pupi1985/patch-154
Invalidate cache when performing additional post operations
2 parents ada6fd3 + 2af5aa0 commit 99e6bb8

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

qa-include/app/post-create.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
require_once QA_INCLUDE_DIR . 'db/points.php';
3030
require_once QA_INCLUDE_DIR . 'db/hotness.php';
3131
require_once QA_INCLUDE_DIR . 'util/string.php';
32+
require_once QA_INCLUDE_DIR . 'app/post-update.php';
3233

3334

3435
/**
@@ -234,6 +235,8 @@ function qa_answer_create($userid, $handle, $cookieid, $content, $format, $text,
234235
qa_db_points_update_ifuser($userid, 'aposts');
235236
}
236237

238+
qa_question_uncache($question['postid']);
239+
237240
qa_report_event($queued ? 'a_queue' : 'a_post', $userid, $handle, $cookieid, array(
238241
'postid' => $postid,
239242
'parentid' => $question['postid'],
@@ -326,6 +329,8 @@ function qa_comment_create($userid, $handle, $cookieid, $content, $format, $text
326329
$thread[] = $comment;
327330
}
328331

332+
qa_question_uncache($question['postid']);
333+
329334
qa_report_event($queued ? 'c_queue' : 'c_post', $userid, $handle, $cookieid, array(
330335
'postid' => $postid,
331336
'parentid' => $parent['postid'],

qa-include/app/post-update.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ function qa_question_set_content($oldquestion, $title, $content, $format, $text,
113113
}
114114
}
115115

116+
qa_question_uncache($oldquestion['postid']);
117+
116118
$eventparams = array(
117119
'postid' => $oldquestion['postid'],
118120
'title' => $title,
@@ -726,6 +728,8 @@ function qa_answer_set_content($oldanswer, $content, $format, $text, $notify, $u
726728
qa_post_index($oldanswer['postid'], 'A', $question['postid'], $oldanswer['parentid'], null, $content, $format, $text, null, $oldanswer['categoryid']);
727729
}
728730

731+
qa_question_uncache($question['postid']);
732+
729733
$eventparams = array(
730734
'postid' => $oldanswer['postid'],
731735
'parentid' => $oldanswer['parentid'],
@@ -1136,6 +1140,8 @@ function qa_comment_set_content($oldcomment, $content, $format, $text, $notify,
11361140
qa_post_index($oldcomment['postid'], 'C', $question['postid'], $oldcomment['parentid'], null, $content, $format, $text, null, $oldcomment['categoryid']);
11371141
}
11381142

1143+
qa_question_uncache($question['postid']);
1144+
11391145
$eventparams = array(
11401146
'postid' => $oldcomment['postid'],
11411147
'parentid' => $oldcomment['parentid'],

0 commit comments

Comments
 (0)