function fieldgroup_update_2 in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 5 fieldgroup.install \fieldgroup_update_2()
- 6.2 modules/fieldgroup/fieldgroup.install \fieldgroup_update_2()
add display settings for the group
File
- modules/
fieldgroup/ fieldgroup.install, line 100 - Implementation of hook_install().
Code
function fieldgroup_update_2() {
$ret = array();
if (!db_table_exists('node_group')) {
return $ret;
}
// set settings column to accept larger values
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql('ALTER TABLE {node_group} CHANGE settings settings mediumtext NOT NULL');
break;
case 'pgsql':
db_change_column($ret, 'node_group', 'settings', 'settings', 'text', array(
'not null' => TRUE,
));
break;
}
// move description into the settings array, and add new settings
$result = db_query("SELECT * FROM {node_group}");
while ($group = db_fetch_array($result)) {
$settings = array();
$settings['form'] = unserialize($group['settings']);
$settings['form']['description'] = $group['description'];
$settings['display'] = array(
'collapsible' => 0,
'collapsed' => 0,
'description' => '',
);
$ret[] = update_sql("UPDATE {node_group} SET settings = '" . db_escape_string(serialize($settings)) . "', description = '' WHERE group_name = '" . $group['group_name'] . "'");
}
// drop description column
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql('ALTER TABLE {node_group} DROP description');
break;
case 'pgsql':
// Postgres only supports dropping of columns since 7.4
break;
}
return $ret;
}