Skip to content

Commit

Permalink
Merge pull request q2a#949 from pupi1985/patch-154
Browse files Browse the repository at this point in the history
Invalidate cache when performing additional post operations
  • Loading branch information
svivian authored Jul 12, 2023
2 parents ada6fd3 + 2af5aa0 commit 99e6bb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qa-include/app/post-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require_once QA_INCLUDE_DIR . 'db/points.php';
require_once QA_INCLUDE_DIR . 'db/hotness.php';
require_once QA_INCLUDE_DIR . 'util/string.php';
require_once QA_INCLUDE_DIR . 'app/post-update.php';


/**
Expand Down Expand Up @@ -234,6 +235,8 @@ function qa_answer_create($userid, $handle, $cookieid, $content, $format, $text,
qa_db_points_update_ifuser($userid, 'aposts');
}

qa_question_uncache($question['postid']);

qa_report_event($queued ? 'a_queue' : 'a_post', $userid, $handle, $cookieid, array(
'postid' => $postid,
'parentid' => $question['postid'],
Expand Down Expand Up @@ -326,6 +329,8 @@ function qa_comment_create($userid, $handle, $cookieid, $content, $format, $text
$thread[] = $comment;
}

qa_question_uncache($question['postid']);

qa_report_event($queued ? 'c_queue' : 'c_post', $userid, $handle, $cookieid, array(
'postid' => $postid,
'parentid' => $parent['postid'],
Expand Down
6 changes: 6 additions & 0 deletions qa-include/app/post-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ function qa_question_set_content($oldquestion, $title, $content, $format, $text,
}
}

qa_question_uncache($oldquestion['postid']);

$eventparams = array(
'postid' => $oldquestion['postid'],
'title' => $title,
Expand Down Expand Up @@ -726,6 +728,8 @@ function qa_answer_set_content($oldanswer, $content, $format, $text, $notify, $u
qa_post_index($oldanswer['postid'], 'A', $question['postid'], $oldanswer['parentid'], null, $content, $format, $text, null, $oldanswer['categoryid']);
}

qa_question_uncache($question['postid']);

$eventparams = array(
'postid' => $oldanswer['postid'],
'parentid' => $oldanswer['parentid'],
Expand Down Expand Up @@ -1136,6 +1140,8 @@ function qa_comment_set_content($oldcomment, $content, $format, $text, $notify,
qa_post_index($oldcomment['postid'], 'C', $question['postid'], $oldcomment['parentid'], null, $content, $format, $text, null, $oldcomment['categoryid']);
}

qa_question_uncache($question['postid']);

$eventparams = array(
'postid' => $oldcomment['postid'],
'parentid' => $oldcomment['parentid'],
Expand Down

0 comments on commit 99e6bb8

Please sign in to comment.