You are here

availability_calendars.install in Availability Calendars 5

File

availability_calendars.install
View source
<?php

/**
 * Install file for Availability Calendars module.
 */

/**
 * Implementation of hook_install().
 */
function availability_calendars_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("\n       CREATE TABLE {availability_calendars_day} (\n         nid int unsigned NOT NULL,\n         year int unsigned NOT NULL,\n         month int unsigned NOT NULL,\n         day int unsigned NOT NULL,\n         status int unsigned\n       ) /*!40100 DEFAULT CHARACTER SET utf8 */\n     ");
      db_query("\n       CREATE TABLE {availability_calendars_week} (\n         nid int unsigned NOT NULL,\n         year int unsigned NOT NULL,\n         month int unsigned NOT NULL,\n         week int unsigned NOT NULL,\n         note varchar(64)\n       ) /*!40100 DEFAULT CHARACTER SET utf8 */\n     ");
      break;
    case 'pgsql':
      drupal_set_message(t('Sorry, there is no pgsql support at present.'));
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function availability_calendars_uninstall() {
  db_query('DROP TABLE {availability_calendars_day}');
  db_query('DROP TABLE {availability_calendars_week}');
  variable_del('availability_calendars_display_nodeview');
  foreach (node_get_types() as $type => $name) {
    variable_del('availability_calendars_' . $type);
  }
  drupal_set_message(t('Availability Calendars module uninstalled successfully.'), 'warning');
}

Functions