Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.1
Component:
fieldgroup.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jan 2009 at 20:52 UTC
Updated:
21 Jan 2009 at 21:20 UTC
I noticed that when I hit the module admin page there was an unnatural number of cache_clear_all(); calls from fieldgroup_content_fieldapi();, where the op had simply been a 'read' op. Looking at fieldgroup_content_fieldapi();, all it does is:
function fieldgroup_content_fieldapi($op, $field) {
switch ($op) {
case 'delete':
db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s'", $field['field_name']);
break;
}
cache_clear_all('fieldgroup_data', content_cache_tablename());
}
However, that cache_clear_all(); is always being invoked when the hook is called. Unless there's a particular reason for this, I'd propose it be moved into the switch-statement:
function fieldgroup_content_fieldapi($op, $field) {
switch ($op) {
case 'delete':
db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s'", $field['field_name']);
cache_clear_all('fieldgroup_data', content_cache_tablename());
break;
}
}
Attached is a patch that moves the cache clearing into the switch.
| Comment | File | Size | Author |
|---|---|---|---|
| fieldgroup_cache.diff | 555 bytes | fractile81 |
Comments
Comment #1
yched commentedIndeed. Committed, thanks !