forked from IceCreamYou/Drupal-Activity-Log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity_log.install
More file actions
311 lines (307 loc) · 9.31 KB
/
activity_log.install
File metadata and controls
311 lines (307 loc) · 9.31 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?php
/**
* @file
* (Un)installs the Rules Activity Logging module.
*/
/**
* Implementation of hook_schema().
*/
function activity_log_schema() {
$schema = array();
$schema['activity_log_templates'] = array(
'description' => 'Stores log templates.',
'fields' => array(
'tid' => array(
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'The template ID.',
),
'rule' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'The rule with which this template is associated.',
),
'action_label' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'The label of the action with which this template is associated.',
),
'template' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'The template.',
),
'group_template' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'The grouped message template.',
),
'translations' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'A serialized array containing translations for both the template and group_template field',
),
'group_summary' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'The short template summary for grouped messages.',
),
'collapse_method' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'The method used to combine action summaries if applicable.',
),
'stream_owner_id_template' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'Something which, when evaluated, returns the ID of the entity in whose stream messages using this template will appear.',
),
'pid' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The public name ID.',
),
'eval_input' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'An array of the input evaluators to run over the template.',
),
),
'primary key' => array('tid'),
);
$schema['activity_log_events'] = array(
'description' => 'Stores activity records.',
'fields' => array(
'aid' => array(
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'The activity ID.',
),
'tid' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The template ID.',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The time the activity occurred.',
),
'acting_uid' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The ID of the user who took the action.',
),
'stream_owner_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The ID of the entity in whose stream this record should appear.',
),
'stream_owner_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The entity type of the stream owner.',
),
'target_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The ID of the entity this action is about.',
),
'target_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The type of the entity this action is about.',
),
'target_class' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The Rules data type class of the entity this action is about.',
),
'id_map' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'Data used to generate tokens to interpret the message.',
),
),
'indexes' => array(
'tid' => array('tid'),
'created' => array('created'),
'acting_uid' => array('acting_uid'),
'stream_owner_id' => array('stream_owner_id'),
'target_id' => array('target_id'),
),
'primary key' => array('aid'),
);
$schema['activity_log_messages'] = array(
'description' => 'Stores the information used to build the actual streams, including grouped events.',
'fields' => array(
'mid' => array(
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'The message ID.',
),
'tid' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The template ID.',
),
'aids' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'A comma-separated list of activity record IDs (foreign keys to the events table).',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The time the first event in the group occurred.',
),
'last_updated' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The time the most recent event was added to this group.',
),
'stream_owner_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The ID of the entity in whose stream this record should appear.',
),
'stream_owner_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The entity type of the stream owner.',
),
'target_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The ID of the entity this action is about.',
),
'target_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The type of the entity this action is about.',
),
'acting_uid' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
'description' => 'The ID of the user who took the action.',
),
),
'indexes' => array(
'tid' => array('tid'),
'last_updated' => array('last_updated'),
'stream_owner_id' => array('stream_owner_id'),
'target_id' => array('target_id'),
'acting_uid' => array('acting_uid'),
),
'primary key' => array('mid'),
);
$schema['activity_log_disabled_types'] = array(
'description' => 'Stores log templates.',
'fields' => array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The ID of the user who disabled this type.',
),
'pid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The activity type the user does not want included in their stream.',
),
),
'indexes' => array(
'uid' => array('uid'),
),
);
$schema['activity_log_action_names'] = array(
'description' => 'Stores activity records.',
'fields' => array(
'pid' => array(
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'The name ID.',
),
'public_name' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'The title of the activity type that is shown to users who have the option to enable/disable activity types.',
),
),
'unique keys' => array(
'public_name' => array('public_name'),
),
'primary key' => array('pid'),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function activity_log_install() {
drupal_install_schema('activity_log');
drupal_set_message(st('The Activity Log module was successfully installed.') .' '.
st('To begin recording activity messages, <a href="@rules">create a Rule</a> that executes the "Log Activity" action.', array('@rules' => url('admin/rules/trigger')))
);
}
/**
* Implementation of hook_uninstall().
*/
function activity_log_uninstall() {
drupal_uninstall_schema('activity_log');
variable_del('activity_log_max_age');
if (db_table_exists('radioactivity')) {
db_query("DELETE FROM {radioactivity} WHERE class='act_log'");
}
}