| 1 |
<?php |
<?php |
| 2 |
// $Id: troll.install,v 1.5 2009/02/11 18:16:09 deekayen Exp $ |
// $Id: troll.install,v 1.5.2.1 2009/02/11 18:52:14 deekayen Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 53 |
*/ |
*/ |
| 54 |
/* |
/* |
| 55 |
function troll_update_2() { |
function troll_update_2() { |
| 56 |
return _system_update_utf8(array('troll_blacklist', 'troll_ip_ban', 'troll_ip_track', 'troll_whitelist')); |
return _system_update_utf8(array('troll_blacklist', 'troll_ip_ban', 'troll_ip_track', 'troll_whitelist')); |
| 57 |
} |
} |
| 58 |
*/ |
*/ |
| 59 |
|
|
| 60 |
/** |
/** |
| 61 |
|
* Support IPv6 address lengths. |
| 62 |
|
* |
| 63 |
|
* @return array |
| 64 |
|
*/ |
| 65 |
|
function troll_update_5000() { |
| 66 |
|
$ret = array(); |
| 67 |
|
|
| 68 |
|
db_drop_unique_key('troll_ip_ban', 'ip'); |
| 69 |
|
db_change_field($ret, 'troll_ip_ban', 'ip_address', 'ip_address', array('type' => 'varchar', 'length' => '39', 'not null' => TRUE, 'default' => '')); |
| 70 |
|
db_add_unique_key($ret, 'troll_ip_ban', 'ip', array('ip_address')); |
| 71 |
|
|
| 72 |
|
db_change_field($ret, 'troll_ip_track', 'ip_address', 'ip_address', array('type' => 'varchar', 'length' => '39', 'not null' => TRUE, 'default' => '')); |
| 73 |
|
return $ret; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
* Implementation of hook_uninstall(). |
* Implementation of hook_uninstall(). |
| 78 |
*/ |
*/ |
| 79 |
function troll_uninstall() { |
function troll_uninstall() { |
| 102 |
'fields' => array( |
'fields' => array( |
| 103 |
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
| 104 |
'accessed' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
'accessed' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
| 105 |
'ip_address' => array('type' => 'varchar', 'length' => '20', 'not null' => TRUE, 'default' => ''), |
'ip_address' => array('type' => 'varchar', 'length' => '39', 'not null' => TRUE, 'default' => ''), |
| 106 |
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11')), |
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '11')), |
| 107 |
'indexes' => array( |
'indexes' => array( |
| 108 |
'uid' => array('uid')), |
'uid' => array('uid')), |
| 110 |
$schema['troll_ip_ban'] = array( |
$schema['troll_ip_ban'] = array( |
| 111 |
'fields' => array( |
'fields' => array( |
| 112 |
'iid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '11'), |
'iid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '11'), |
| 113 |
'ip_address' => array('type' => 'varchar', 'length' => '30', 'not null' => TRUE, 'default' => ''), |
'ip_address' => array('type' => 'varchar', 'length' => '39', 'not null' => TRUE, 'default' => ''), |
| 114 |
'domain_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), |
'domain_name' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), |
| 115 |
'expires' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
'expires' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
| 116 |
'created' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |
'created' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '11'), |