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.

CommentFileSizeAuthor
fieldgroup_cache.diff555 bytesfractile81

Comments

yched’s picture

Status: Active » Fixed

Indeed. Committed, thanks !

Status: Fixed » Closed (fixed)

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