Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We can simplify this function by removing the $reset param, and using drupal_static_reset() when we want to reset its cache instead.
Comment | File | Size | Author |
---|---|---|---|
#3 | flag-replace-reset-param-in-flag-get-user-flags-1886560-3.patch | 1.68 KB | alexweber |
Comments
Comment #1
alexweber CreditAttribution: alexweber commentedThe $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?
Comment #2
joachim CreditAttribution: joachim commentedThere's only one place where the reset functionality is used, and it's called like this:
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.
Comment #3
alexweber CreditAttribution: alexweber commentedThanks 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()
Comment #4
joachim CreditAttribution: joachim commentedThanks!
git commit -m "Issue #1886560 by alexweber: Removed reset parameter in flag_get_user_flags() in favour of drupal_static_reset()." --author="alexweber "