function content_update_6002 in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 6.3 content.install \content_update_6002()
- 6.2 content.install \content_update_6002()
Get rid of automatic per content tables for content types that have no fields. Switching to adding those tables only when needed.
File
- ./
content.install, line 264
Code
function content_update_6002() {
$ret = array();
$db_types = content_types_install();
$field_types = array();
$result = db_query("SELECT DISTINCT type_name FROM {" . content_instance_tablename() . "}");
while ($type = db_fetch_array($result)) {
$field_types[] = $type['type_name'];
}
foreach ($db_types as $content_type => $content_info) {
if (!in_array($content_type, $field_types)) {
$table = _content_tablename($content_type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE);
if (db_table_exists($table)) {
db_drop_table($ret, $table);
}
}
}
variable_set('content_schema_version', 6002);
content_clear_type_cache(TRUE);
return $ret;
}