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.
Problem/Motivation
FlagCountManagerInterface::getTotals() has a $reset parameter for clearing the static cache. However, this is no longer needed, since as of D7 (!!) functions should use drupal_static() to allow their cache to be cleared.
Proposed resolution
Remove the parameter, and the code that clears the cache when the parameter is set to TRUE.
Remaining tasks
- create a patch
- update the CR at https://www.drupal.org/node/2476349
Comment | File | Size | Author |
---|---|---|---|
#1 | flag-remove_reset_gettotals-2488288-1.patch | 1.41 KB | gnuget |
Comments
Comment #1
gnugetPatch attached.
Comment #2
joachim CreditAttribution: joachim commentedThanks for the patch!
Let's see what the testbot says...
Comment #3
BerdirUhm ;)
#1577902: [META] Remove all usages of drupal_static() & drupal_static_reset()
drupal_static() shouldn't be used in services. Which means that some way to reset it is often necessary, but usually in the form of a separate method. It's also usually only necessary for tests.
Comment #4
joachim CreditAttribution: joachim commentedThanks for the info!
We can still fix this issue as is though, and then move on to changing drupal_static() calls in new one.
Comment #5
joachim CreditAttribution: joachim commentedFiled #2488458: remove calls to drupal_static().
Comment #6
joachim CreditAttribution: joachim commentedTests pass, patch looks good.
Committed, and I'm about to update the CR. EDIT: which doesn't mention the $reset at all, so it's ok already.
Thanks!