5 * Install, update, and uninstall functions for tracker.module.
9 * Implements hook_uninstall().
11 function tracker_uninstall() {
12 \Drupal::state()->delete('tracker.index_nid');
16 * Implements hook_install().
18 function tracker_install() {
19 $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField();
21 \Drupal::state()->set('tracker.index_nid', $max_nid);
22 // To avoid timing out while attempting to do a complete indexing, we
23 // simply call our cron job to remove stale records and begin the process.
29 * Implements hook_schema().
31 function tracker_schema() {
32 $schema['tracker_node'] = [
33 'description' => 'Tracks when nodes were last changed or commented on.',
36 'description' => 'The {node}.nid this record tracks.',
43 'description' => 'Boolean indicating whether the node is published.',
50 'description' => 'The Unix timestamp when the node was most recently saved or commented on.',
58 'tracker' => ['published', 'changed'],
60 'primary key' => ['nid'],
64 'columns' => ['nid' => 'nid'],
69 $schema['tracker_user'] = [
70 'description' => 'Tracks when nodes were last changed or commented on, for each user that authored the node or one of its comments.',
73 'description' => 'The {node}.nid this record tracks.',
80 'description' => 'The {users}.uid of the node author or commenter.',
87 'description' => 'Boolean indicating whether the node is published.',
94 'description' => 'The Unix timestamp when the node was most recently saved or commented on.',
102 'tracker' => ['uid', 'published', 'changed'],
104 'primary key' => ['nid', 'uid'],
108 'columns' => ['nid' => 'nid'],
112 'columns' => ['uid' => 'uid'],