We can simplify this function by removing the $reset param, and using drupal_static_reset() when we want to reset its cache instead.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexweber’s picture

The $reset implementation is simple enough... if we remove the param we won't know when to reset it, where would the drupal_static_reset() go?

joachim’s picture

There's only one place where the reset functionality is used, and it's called like this:

    flag_get_user_flags(NULL, NULL, NULL, NULL, TRUE);

This is a pattern that was quite common in core up to D6, but for D7 it's been replaced with drupal_static_reset() -- so instead of that awkward call with all the NULL, call drupal_static_reset() with the name of the static cache to clear.

alexweber’s picture

Status: Active » Needs review
FileSize
1.68 KB

Thanks Joachim, that makes sense now :)

FYI: I've created a new related issue: #1894030: replace reset param in flag_get_counts() with drupal_static_reset()

joachim’s picture

Status: Needs review » Fixed

Thanks!

git commit -m "Issue #1886560 by alexweber: Removed reset parameter in flag_get_user_flags() in favour of drupal_static_reset()." --author="alexweber "

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