source: sipes/modules_contrib/email/email.install @ 8a8efa8

stableversion-3.0
Last change on this file since 8a8efa8 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100755
File size: 2.0 KB
Línea 
1<?php
2
3
4/**
5 * Implementation of hook_install().
6 */
7function email_install() {
8  drupal_load('module', 'content');
9  content_notify('install', 'email');
10}
11
12/**
13 * Implementation of hook_uninstall().
14 */
15function email_uninstall() {
16  drupal_load('module', 'content');
17  content_notify('uninstall', 'email');
18}
19
20/**
21 * Implementation of hook_enable().
22 *
23 * Notify content module when this module is enabled.
24 */
25function email_enable() {
26  drupal_load('module', 'content');
27  content_notify('enable', 'email');
28}
29
30/**
31 * Implementation of hook_disable().
32 *
33 * Notify content module when this module is disabled.
34 */
35function email_disable() {
36  drupal_load('module', 'content');
37  content_notify('disable', 'email');
38}
39
40/**
41 * Implemenation of hook_update_N();
42 *
43 * Update from 5.x to 6.x
44 *
45 * Set all columns to accept NULL values and set empty string values in the
46 * database to NULL.
47 */
48function email_update_6001() {
49  if ($abort = content_check_update('email')) {
50    return $abort;
51  }
52 
53  drupal_load('module', 'content');
54  $ret = array();
55  $ret[] = update_sql("UPDATE {". content_instance_tablename() ."} SET widget_type = 'email_textfield' WHERE widget_type = 'email'");
56  content_associate_fields('email');
57  content_clear_type_cache(TRUE);
58
59  include_once(drupal_get_path('module', 'content') .'/content.install');
60  $types = content_types_install();
61  foreach ($types as $type_name => $fields) {
62    foreach ($fields as $field) {
63      switch ($field['type']) {
64        case 'email':
65          $db_info = content_database_info($field);
66          $table = $db_info['table'];
67          foreach ($db_info['columns'] as $column => $attributes) {
68            $attributes['not null'] = FALSE;
69            $column = $attributes['column'];
70            db_change_field($ret, $table, $column, $column, $attributes);
71            db_field_set_no_default($ret, $table, $column);
72            $ret[] = update_sql("UPDATE {". $table ."} SET ". $column ." = NULL WHERE ". $column ." = ''");
73
74          }
75          break;
76      }
77    }
78  }
79  return $ret;
80}
81
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.