You are here

sms.install in SMS Framework 5

File

sms.install
View source
<?php

function sms_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $success = TRUE;
      db_query('
         CREATE TABLE {sms_messages} (
         mid int(10) NOT NULL,
         sent int(11) NOT NULL,
         status int(11) NOT NULL,
         destination varchar(64) NOT NULL,
         message text default NULL,
         gateway varchar(64) NOT NULL,
         PRIMARY KEY (mid)) /*!40100 DEFAULT CHARACTER SET utf8 */;
        ');
      db_query('UPDATE {system} SET weight = -5 WHERE name = "sms_sendtophone"');
      break;
  }
  if ($success) {
    drupal_set_message(t('SMS Framework installed succesfully.'));
  }
  else {
    drupal_set_message(t('SMS Framework installation failed. Database tables must be created manually.', 'error'));
  }
}

/**
 * Implementation of hook_uninstall().
 */
function sms_uninstall() {
  db_query('DROP TABLE {sms_messages}');
  drupal_set_message(t('SMS Framework uninstalled successfully.'));
}

/**
 * Update: Removes gateway behavior mapping
 */
function sms_update_1() {
  $ret = array();

  // Remove table
  $ret[] = update_sql("DROP TABLE {sms_mapping}");
  return $ret;
}

Functions

Namesort descending Description
sms_install
sms_uninstall Implementation of hook_uninstall().
sms_update_1 Update: Removes gateway behavior mapping