Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
3 Apr 2009 at 03:09 UTC
Updated:
14 Feb 2010 at 13:00 UTC
Jump to comment: Most recent file
follow-up to: #254491: Standardize static caching
see last patch examples: http://drupal.org/node/254491#comment-1430180 and also: http://drupal.org/node/224333#static_variable_api
Apply this conversion pattern to all modules to convert all static variables there. Pay close attention to any place a reset parameter is provided and add a call to drupal_static_reset() where appropriate (e.g. in any calling function that uses the reset parameter)
Note this can be considered a place-holder issue - comment if you are working on a specific module.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | static_cache_user.patch | 6.58 KB | michaelfavia |
Comments
Comment #1
pwolanin commentedPer discussion w/ catch - if you have a variable name more complex than just __FUNCTION__, use a ':' to separate the suffix (this will avoid colliding with any other valid function name). e.g. :
Comment #2
michaelfavia commentedIm starting on node module now and will post patch as i move through them.
Comment #3
michaelfavia commentedFirst stab at this process please review thoroughly to make sure the rest of these come in cleanly next week. -mf
#423806: Update user module to use drupal_static()
#423822: Update node module to use drupal_static()
Comment #4
JamesAn commentedHere's some more:
#480102: Update aggregator module to use drupal_static()
#480112: Update block module to use drupal_static()
#480122: Update blogapi module to use drupal_static()
#480412: Update book module to use drupal_static()
#480414: Update comment module to use drupal_static()
#480416: Update filter module to use drupal_static()
#480418: Update forum module to use drupal_static()
#480424: Update locale module to use drupal_static()
#480426: Update menu module to use drupal_static()
#480428: Update openid module to use drupal_static()
#480430: Update search module to use drupal_static()
Comment #5
JamesAn commentedAnd some more:
#481498: Update simpletest module to use drupal_static()
#481500: Update syslog module to use drupal_static()
#481502: Update system module to use drupal_static()
#481504: Update translation module to use drupal_static()
#481506: Update trigger module to use drupal_static()
#481508: Update update module to use drupal_static()
Comment #6
JamesAn commentedThis was created a few days ago:
#447862: Convert field to the new static caching API
Comment #7
JamesAn commentedMost of these sub-issues are pretty quick fixes (except for field, locale, node, simpletest, and user).
Comment #8
JamesAn commentedThere are still two static vars:
Both vars in defined within class definitions. I'm assuming you can't register those since there may be multiple instances of the respective classes. Still, it seems like the code is designed so that there won't ever be multiple instances of these two classes. Should these static vars be left alone? Please advice.
Comment #10
pwolanin commentedsetting this one issue as critical to track that all sub-issues are resolved for D7 and that the conversion gets completed
Comment #11
JamesAn commentedRerolled some of the sub-issues.
Locale, search, and filter still need work.
Comment #12
cburschkaThe remaining issues are now locale, search and trigger. IMHO, locale and search are RTBC, while trigger needs only a tiny code-style fix. Once these three are in, this meta-issue can be closed...
Comment #13
agentrickardRe-rolled #423822: Update node module to use drupal_static()
Comment #14
agentrickardA search also reveals 39 uses in 19 files of 'static $var' in /modules and 72 in 29 files inside /includes as of today.
Are we trying to clean all of these up?
Comment #15
cburschka@agentrickard, some uses of local statics are legitimate and will not be converted. I forgot the exact criteria, but apparently drupal_static should only be used for variables that might conceivably be reset at some point.
Comment #16
agentrickardRight, I read the docs on API. Have we sanity checked all the remaining statics?
Comment #17
catchI'm marking this fixed, if we have un-resettable statics, we can find them individually.