Which leads to a query per node, or per comment, when anonymous users don't have access to post comments, just to theme the 'Login or register to post comments' link.

Comments

catch’s picture

Title: user_roles() has no static cache » Broken drupal_static() conversion in theme_comment_post_forbidden()
Component: user system » comment.module
Issue tags: -Needs backport to D6
StatusFileSize
new74.8 KB
new1.38 KB

OK this is just as broken, but for different reasons, just a bad drupal_static() conversion in comment.module.

catch’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Status: Needs work » Needs review

orly.

catch’s picture

Issue tags: +Quick fix

umm, bump?

dww’s picture

catch asked me to review this in IRC. While the previous code was clearly broken, we don't actually need to avoid using drupal_static() entirely, we just need to use it properly. ;) If we initialize the static as NULL, we can test !isset() and set the real value for the variable. Also cleaned up the code comments a bit to clarify.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Both changes make sense, think I just overreacted to the way we've been converting every, single, thing to drupal_static() indiscriminately.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Re-worked some of the grammar on the comments and committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Performance, -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.