6 * Install file for the link module.
10 * Implementation of hook_install().
12 function link_install() {
13 drupal_load('module', 'content');
14 content_notify('install', 'link');
18 * Implementation of hook_uninstall().
20 function link_uninstall() {
21 drupal_load('module', 'content');
22 content_notify('uninstall', 'link');
26 * Implementation of hook_enable().
28 function link_enable() {
29 drupal_load('module', 'content');
30 content_notify('enable', 'link');
34 * Implementation of hook_disable().
36 function link_disable() {
37 drupal_load('module', 'content');
38 content_notify('disable', 'link');
42 * Removed link.module created tables, move data to content.module tables
44 * Even though most everyone will not be using this particular update, several
45 * folks have complained that their upgrades of link.module do not work because
46 * of this function being missing when schema expects it. - JCF
47 * And on further review, I'm removing the body, since some of those calls
48 * no longer exist in Drupal 6. Remember to upgrade from 4.7 to 5 first, and
49 * *then* from 5 to 6. kthx! -JCF
51 function link_update_1() {
59 * Ensure that content.module is updated before link module.
61 function link_update_6000() {
62 if ($abort = content_check_update('link')) {
69 * Change the database schema to allow NULL values.
71 function link_update_6001() {
74 // Build a list of fields that need updating.
75 $update_fields = array();
76 foreach (content_types_install() as
$type_name => $fields) {
77 foreach ($fields as
$field) {
78 if ($field['type'] == 'link') {
79 // We only process a given field once.
80 $update_fields[$field['field_name']] = $field;
85 // Update each field's storage to match the current definition.
86 foreach ($update_fields as
$field) {
87 $db_info = content_database_info($field);
88 foreach ($db_info['columns'] as
$column) {
89 db_change_field($ret, $db_info['table'], $column['column'], $column['column'], $column);
90 $ret[] = update_sql("UPDATE {".
$db_info['table'] .
"} SET ".
$column['column'] .
" = NULL WHERE ".
$column['column'] .
" = '' OR ".
$column['column'] .
" = 'N;'");
94 // Let CCK re-associate link fields with Link module and activate the fields.
95 content_associate_fields('link');