5 * Implementation of hook_install().
7 function link_install() {
8 content_notify('install', 'link');
12 * Implementation of hook_uninstall().
14 function link_uninstall() {
15 content_notify('uninstall', 'link');
19 * Implementation of hook_enable().
21 function link_enable() {
22 content_notify('enable', 'link');
26 * Implementation of hook_disable().
28 function link_disable() {
29 content_notify('disable', 'link');
33 * Removed link.module created tables, move data to content.module tables
35 function link_update_1() {
38 include_once(drupal_get_path('module', 'content') .
'/content.module');
39 include_once(drupal_get_path('module', 'content') .
'/content_admin.inc');
41 $fields = content_fields();
43 foreach ($fields as
$field) {
44 switch ($field['type']) {
47 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE
, 'default' => "''"),
48 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE
, 'default' => "''"),
49 'attributes' => array('type' => 'mediumtext', 'not null' => FALSE
),
51 content_alter_db_field(array(), array(), $field, $columns);
52 $db_info = content_database_info($field);
53 if ($field['multiple']) {
54 $ret[] = update_sql('INSERT INTO {'.
$db_info['table'] .
'} (vid, delta, nid, '.
$field['field_name'] .
'_url, '.
$field['field_name'] .
'_title, '.
$field['field_name'] .
"_attributes) SELECT vid, delta, nid, field_url, field_title, attributes FROM {node_field_link_data} WHERE field_name = '".
$field['field_name'] .
"'");
57 $ret[] = update_sql('UPDATE {'.
$db_info['table'] .
'} c, {node_field_link_data} l SET c.'.
$field['field_name'] .
'_url = l.field_url, c.'.
$field['field_name'] .
'_title = l.field_title, c.'.
$field['field_name'] .
"_attributes = l.attributes WHERE l.field_name = '".
$field['field_name'] .
"' AND c.vid = l.vid AND c.nid = l.nid");
62 $ret[] = update_sql('DROP TABLE {node_field_link_data}');
64 db_query('DELETE FROM {cache}');