contact.install

  1. drupal
    1. 5 modules/contact/contact.install
    2. 6 modules/contact/contact.install
    3. 7 modules/contact/contact.install
    4. 8 core/modules/contact/contact.install

Install, update and uninstall functions for the contact module.

Functions & methods

NameDescription
contact_installImplements hook_install().
contact_schemaImplements hook_schema().
contact_uninstallImplements hook_uninstall().

File

core/modules/contact/contact.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the contact module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function contact_schema() {
  10. $schema['contact'] = array(
  11. 'description' => 'Contact form category settings.',
  12. 'fields' => array(
  13. 'cid' => array(
  14. 'type' => 'serial',
  15. 'unsigned' => TRUE,
  16. 'not null' => TRUE,
  17. 'description' => 'Primary Key: Unique category ID.',
  18. ),
  19. 'category' => array(
  20. 'type' => 'varchar',
  21. 'length' => 255,
  22. 'not null' => TRUE,
  23. 'default' => '',
  24. 'description' => 'Category name.',
  25. 'translatable' => TRUE,
  26. ),
  27. 'recipients' => array(
  28. 'type' => 'text',
  29. 'not null' => TRUE,
  30. 'size' => 'big',
  31. 'description' => 'Comma-separated list of recipient e-mail addresses.',
  32. ),
  33. 'reply' => array(
  34. 'type' => 'text',
  35. 'not null' => TRUE,
  36. 'size' => 'big',
  37. 'description' => 'Text of the auto-reply message.',
  38. ),
  39. 'weight' => array(
  40. 'type' => 'int',
  41. 'not null' => TRUE,
  42. 'default' => 0,
  43. 'description' => "The category's weight.",
  44. ),
  45. 'selected' => array(
  46. 'type' => 'int',
  47. 'not null' => TRUE,
  48. 'default' => 0,
  49. 'size' => 'tiny',
  50. 'description' => 'Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)',
  51. ),
  52. ),
  53. 'primary key' => array('cid'),
  54. 'unique keys' => array(
  55. 'category' => array('category'),
  56. ),
  57. 'indexes' => array(
  58. 'list' => array('weight', 'category'),
  59. ),
  60. );
  61. return $schema;
  62. }
  63. /**
  64. * Implements hook_install().
  65. */
  66. function contact_install() {
  67. // Insert a default contact category.
  68. db_insert('contact')
  69. ->fields(array(
  70. 'category' => 'Website feedback',
  71. 'recipients' => variable_get('site_mail', ini_get('sendmail_from')),
  72. 'selected' => 1,
  73. 'reply' => '',
  74. ))
  75. ->execute();
  76. }
  77. /**
  78. * Implements hook_uninstall().
  79. */
  80. function contact_uninstall() {
  81. variable_del('contact_default_status');
  82. variable_del('contact_threshold_limit');
  83. variable_del('contact_threshold_window');
  84. }
Login or register to post comments