You are here

function content_types_rebuild in Content Construction Kit (CCK) 5

Rebuild content type information from node tables.

Used to update CCK tables that might have missed changes made when CCK was disabled. Called by hook_form_alter() on system modules page whenever CCK is enabled.

1 call to content_types_rebuild()
content_enable in ./content.module
Make sure that CCK content type info is synched with node type data any time the content module is enabled.

File

./content_crud.inc, line 88
Create/Read/Update/Delete functions for CCK-defined object types.

Code

function content_types_rebuild() {
  $db_types = content_types();
  $result = db_query("SELECT type_name FROM {node_field_instance}");
  while ($type = db_fetch_array($result)) {
    $field_types[] = $type['type_name'];
  }
  foreach ($db_types as $content_type) {

    // Find content types that are missing the content table and add it
    content_type_create((object) array(
      'type' => $content_type['type'],
    ));
  }
  content_clear_type_cache();
}