You are here

function restrict_by_ip_install in Restrict Login or Role Access by IP Address 5

Same name and namespace in other branches
  1. 6.3 restrict_by_ip.install \restrict_by_ip_install()
  2. 6 restrict_by_ip.install \restrict_by_ip_install()
  3. 6.2 restrict_by_ip.install \restrict_by_ip_install()

Implementation of hook_install(). Creates a table of the variables that will be needed to use this module

File

./restrict_by_ip.install, line 7

Code

function restrict_by_ip_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {restrict_by_ip} (\n        uid int unsigned NOT NULL,\n        restrict_by_ip_address varchar(128),\n        PRIMARY KEY(uid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;\n      ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {restrict_by_ip} (\n        uid int NOT NULL, \n\t\t    restrict_by_ip_address character(128)\n        PRIMARY KEY(uid)\n        );\n      ");
      break;
  }
  watchdog('restrict_by_ip', 'restrict_by_ip module installed');
  drupal_set_message(t('The restrict_by_ip module was installed.'));
}