5 * (Un)installs the Rules Activity Logging module.
9 * Implementation of hook_schema().
11 function activity_log_schema() {
13 $schema['activity_log_templates'] = array(
14 'description' => 'Stores log templates.',
20 'description' => 'The template ID.',
27 'description' => 'The rule with which this template is associated.',
29 'action_label' => array(
34 'description' => 'The label of the action with which this template is associated.',
39 'description' => 'The template.',
41 'group_template' => array(
44 'description' => 'The grouped message template.',
46 'group_summary' => array(
49 'description' => 'The short template summary for grouped messages.',
51 'collapse_method' => array(
56 'description' => 'The method used to combine action summaries if applicable.',
63 'description' => 'The public name ID.',
65 'eval_input' => array(
68 'description' => 'An array of the input evaluators to run over the template.',
73 'description' => 'The CSS and JS resources required by this template.',
81 'description' => 'Whether messages saved with this template should be cached.',
83 'display_type' => array(
88 'description' => 'Where messages generated using this template should be displayed. Typical values are "web," "email," and "alert." There may also be a use for "mobile," "print," etc. but there is not a default implementation for these.',
92 'pid' => array('pid'),
94 'primary key' => array('tid'),
96 $schema['activity_log_events'] = array(
97 'description' => 'Stores activity records.',
103 'description' => 'The activity ID.',
110 'description' => 'The template ID.',
117 'description' => 'The time the activity occurred.',
119 'acting_uid' => array(
124 'description' => 'The ID of the user who took the action.',
126 'target_id' => array(
131 'description' => 'The ID of the entity this action is about.',
133 'target_type' => array(
138 'description' => 'The type of the entity this action is about.',
140 'target_class' => array(
145 'description' => 'The Rules data type class of the entity this action is about.',
150 'description' => 'Data used to generate tokens to interpret the message.',
154 'tid' => array('tid'),
155 'created' => array('created'),
156 'acting_uid' => array('acting_uid'),
157 'target_id' => array('target_id'),
159 'primary key' => array('aid'),
161 $schema['activity_log_messages'] = array(
162 'description' => 'Stores the information used to build the actual streams, including grouped events.',
168 'description' => 'The message ID.',
175 'description' => 'The template ID.',
180 'description' => 'A comma-separated list of activity record IDs (foreign keys to the events table).',
187 'description' => 'The time the first event in the group occurred.',
189 'last_updated' => array(
194 'description' => 'The time the most recent event was added to this group.',
196 'stream_owner_id' => array(
201 'description' => 'The ID of the entity in whose stream this record should appear.',
203 'stream_owner_type' => array(
208 'description' => 'The entity type of the stream owner.',
210 'viewer_id' => array(
212 'unsigned' => FALSE
, // Negative numbers are flags. Range -/+ 2,147,483,647
215 'description' => 'The ID of the user to whom this message will appear.',
217 'target_id' => array(
222 'description' => 'The ID of the entity this action is about.',
224 'target_type' => array(
229 'description' => 'The type of the entity this action is about.',
231 'acting_uid' => array(
236 'description' => 'The ID of the user who took the action.',
241 'description' => 'The cached message HTML, fully evaluated.',
245 'tid' => array('tid'),
246 'last_updated' => array('last_updated'),
247 'stream_owner_id' => array('stream_owner_id'),
248 'viewer_id' => array('viewer_id'),
249 'target_id' => array('target_id'),
250 'acting_uid' => array('acting_uid'),
252 'primary key' => array('mid'),
254 $schema['activity_log_disabled_types'] = array(
255 'description' => 'Stores log templates.',
262 'description' => 'The ID of the user who disabled this type.',
269 'description' => 'The activity type the user does not want included in their stream.',
273 'uid' => array('uid'),
276 $schema['activity_log_action_names'] = array(
277 'description' => 'Stores activity records.',
283 'description' => 'The name ID.',
285 'public_name' => array(
290 'description' => 'The title of the activity type that is shown to users who have the option to enable/disable activity types.',
293 'unique keys' => array(
294 'public_name' => array('public_name'),
296 'primary key' => array('pid'),
302 * Implementation of hook_install().
304 function activity_log_install() {
305 drupal_install_schema('activity_log');
307 module_load_include('module', 'activity_log');
308 if (function_exists('_activity_log_rebuild_templates')) {
309 $default_rule_count = _activity_log_rebuild_templates();
310 if ($default_rule_count) {
311 drupal_set_message(st('Finished building !count default Activity Log templates.', array('!count' => $default_rule_count)));
315 variable_set('facebook_status_user_other_view', 'activity_log_stream');
317 drupal_set_message(st('The Activity Log module has finished installing.') .
' '.
318 empty($default_rule_count) ?
319 st('To begin recording activity messages, <a href="!rules">create a Rule</a> that executes the "Log Activity" action.',
320 array('!rules' => url('admin/rules/trigger'))
321 ) .
' '.
st('Once you have your Rules configured, you can use the <a href="!activities">Activities view</a> to see activity on your site.',
322 array('!activities' => url('activities'))
323 ) : st('Default activity message templates have already been installed.') .
' '.
324 st('Activity Log uses Rules to define its templates, so you can change which ones to use by <a href="!rules">configuring Rules</a>.',
325 array('!rules' => url('admin/rules/trigger'))
331 * Implementation of hook_uninstall().
333 function activity_log_uninstall() {
334 drupal_uninstall_schema('activity_log');
335 variable_del('activity_log_max_age');
336 variable_del('activity_log_comments_bump');
337 if (db_table_exists('radioactivity')) {
338 db_query("DELETE FROM {radioactivity} WHERE class='act_log'");
340 if (!module_exists('facebook_status')) {
341 variable_del('facebook_status_user_other_view');