-
Notifications
You must be signed in to change notification settings - Fork 16
/
islandora_ip_embargo.install
executable file
·135 lines (128 loc) · 3.6 KB
/
islandora_ip_embargo.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* @file
* Handles the install and uninstall of islandora_ip_embargo.
*/
/**
* Implements hook_schema().
*/
function islandora_ip_embargo_schema() {
$schema['islandora_ip_embargo_lists'] = array(
'description' => 'Table that stores lists of IP ranges.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for embargo lists.',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The human readable name of the list.',
),
),
'primary key' => array('lid'),
);
$schema['islandora_ip_embargo_ip_ranges'] = array(
'description' => 'Table that stores lists of IP ranges.',
'fields' => array(
'rid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for IP address ranges.',
),
'low_end' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The low end of the IP address range.',
),
'high_end' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The high end of the IP address range.',
),
'lid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The LID that the range belongs to.',
),
),
'foreign keys' => array(
'list' => array(
'table' => 'islandora_ip_embargo_lists',
'columns' => array('lid' => 'lid'),
),
),
'primary key' => array('rid'),
);
$schema['islandora_ip_embargo_embargoes'] = array(
'description' => 'Table that stores information on embargoed objects.',
'fields' => array(
'pid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The PID of the object being embargoed.',
),
'expiry' => array(
'type' => 'varchar',
'length' => 255,
'description' => "The timestamp of when the embargo should be lifted or 'never'.",
),
'lid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The LID the object is constrained to.',
),
'expiry_event_triggered' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => '0 if the event has not been triggered 1 if it has been.',
),
),
'foreign keys' => array(
'list' => array(
'table' => 'islandora_ip_embargo_lists',
'columns' => array('lid' => 'lid'),
),
),
'primary key' => array('pid'),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function islandora_ip_embargo_uninstall() {
$drupal_variables = array(
'islandora_ip_embargo_embargoed_redirect',
'islandora_ip_embargo_days_before_embargo_trigger',
'islandora_ip_embargo_overlay_text',
'islandora_ip_embargo_overlay_text_color',
);
foreach ($drupal_variables as $drupal_variable) {
variable_del($drupal_variable);
}
}
/**
* Implements hook_update_N().
*/
function islandora_ip_embargo_update_7100() {
$new_field = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => '0 if the event has not been triggered 1 if it has been.',
);
db_add_field('islandora_ip_embargo_embargoes', 'expiry_event_triggered', $new_field);
}