function node_types_rebuild() {
  _node_types_build();

  $node_types = node_get_types('types', NULL, TRUE);

  foreach ($node_types as $type => $info) {
    if (!empty($info->is_new)) {
      node_type_save($info);
    }
    if (!empty($info->disabled)) {
      node_type_delete($info->type);
    }
  }

  _node_types_build();
}

That very first _node_types_build() seems redundant, since that function gets called within node_get_types since $reset = true. We may be doing an extra database query. Is there something else going on that I'm overlooking?

Comments

mot’s picture

Status: Active » Closed (fixed)

Good question. For optimization Issues this needs further analysis. You write "maybe doing an extra database query". Maybe-Queries do cost no resources. Until it is a maybe-query only and not a real one, this can be closed.