restrict_by_ip.install in Restrict Login or Role Access by IP Address 5
File
restrict_by_ip.install
View source
<?php
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.'));
}
function restrict_by_ip_uninstall() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("DROP TABLE {restrict_by_ip}");
break;
case 'pgsql':
db_query("DROP TABLE {restrict_by_ip}");
break;
}
cache_clear_all('*', 'cache', TRUE);
cache_clear_all('*', 'cache_filter', TRUE);
cache_clear_all('*', 'cache_menu', TRUE);
cache_clear_all('*', 'cache_page', TRUE);
watchdog('restrict_by_ip', 'restrict_by_ip module removed');
}