Currently boost is handling comment Reply pages correctly. However not so for edit and delete.

There are three situations from my testing where this is undesirable.

(1) One where anonymous users are given "administer comments" privilege, which is rare and in this case edit and delete of comments by anonymous users will not clear out node cache right away and will also try to make cached pages of edit and delete paths which is not good.

(2) Secondly, assuming only authenticated users have the privilege to edit/delete comments, when anonymous user pulls up a cached node page (with comments) which they will since edit/delete is not forcing a cache refresh of the node page. In this case if anonymous user tries to reply against a comment which has already been deleted they get an invalid page. Also anonymous users will not see any edited comment until cron runs to expire node pages .. which brings us to the third point.

(3) If you are following my strategy with boost, you are not only expiring / removing cached node pages upon node (insert|update|delete) and not every time cron runs. See my post here : http://drupal.org/node/183252#comment-1005770. In this case node pages with comments deleted or edited , will never refresh the node page.

So here is my solution :

in boost.api.inc :

function boost_is_cacheable($path) {

..

 - // Don't cache comment reply pages
 + // Don't cache comment delete, edit or reply pages in case anoanymous users have these privs.


 - if (preg_match('!^comment/reply!', $path))
 + if (preg_match('!^comment/(delete|edit|reply)!', $path))
    return FALSE;

in boost.module

/**
 * Implementation of hook_comment(). Acts on comment modification.
 */
function boost_comment($comment, $op) {
  if (!BOOST_ENABLED) return;
 + $comment_node_nid = is_object($comment) ? $comment->nid :  $comment['nid'];
  switch ($op) {
    case 'insert':
    case 'update':
  + case 'delete':
      // Expire the relevant node page from the static page cache to prevent serving stale content:
 
 -    if (!empty($comment['nid']))
 -       boost_cache_expire('node/' . $comment['nid'], TRUE);
 +    if (!empty($comment_node_nid))
 +       boost_cache_expire('node/' . $comment_node_nid, TRUE);
      break;
  }
}

Pls review and help test. Thanks.

Problem 1) If "administer comments" privs are only given to autheticated users, boost at least does not create a cached .html file but it does not unlink/remove the old cached node page against which the comment is to expire the node immediately when comment is edited or deleted. This is important and needs to be done in the same spirit as the reply (new comment creation) so we always see the comments FRESH -> updated or deleted also .. not just new ones. If this is not done, if an anonymous user pull up the cached page

Problem 2) If edit/delete privs are given to anonymous users then

Comments

drupdrips’s picture

Pls ignore the para after the line "Pls review and help test. Thanks." I was rephrasing and forgot to remove the old lines.

mikeytown2’s picture

Status: Needs review » Closed (fixed)

Closing all 5.x issues; will only reevaluate if someone steps up #454652: Looking for a co-maintainer - 5.x

Reason is 6.x has 10x as many users as 5.x; also last 5.x dev was over a year ago. The 5.x issue queue needs to go.