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
|
<?php
/**
* @file
* Install, update, and uninstall functions for the Statistics module.
*/
/**
* Implements hook_uninstall().
*/
function statistics_uninstall() {
// Remove variables.
variable_del('statistics_count_content_views');
variable_del('statistics_count_content_views_ajax');
variable_del('statistics_enable_access_log');
variable_del('statistics_flush_accesslog_timer');
variable_del('statistics_day_timestamp');
variable_del('statistics_block_top_day_num');
variable_del('statistics_block_top_all_num');
variable_del('statistics_block_top_last_num');
}
/**
* Implements hook_schema().
*/
function statistics_schema() {
$schema['accesslog'] = array(
'description' => 'Stores site access information for statistics.',
'fields' => array(
'aid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique accesslog ID.',
),
'sid' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Browser session ID of user that visited page.',
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'Title of page visited.',
),
'path' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'Internal path to page visited (relative to Drupal root.)',
),
'url' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'Referrer URI.',
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
'description' => 'Hostname of user that visited the page.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => 0,
'description' => 'User {users}.uid that visited the page.',
),
'timer' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Time in milliseconds that the page took to load.',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp of when the page was visited.',
),
),
'indexes' => array(
'accesslog_timestamp' => array('timestamp'),
'uid' => array('uid'),
),
'primary key' => array('aid'),
'foreign keys' => array(
'visitor' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
);
$schema['node_counter'] = array(
'description' => 'Access statistics for {node}s.',
'fields' => array(
'nid' => array(
'description' => 'The {node}.nid for these statistics.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'totalcount' => array(
'description' => 'The total number of times the {node} has been viewed.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'big',
),
'daycount' => array(
'description' => 'The total number of times the {node} has been viewed today.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'medium',
),
'timestamp' => array(
'description' => 'The most recent time the {node} has been viewed.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('nid'),
);
return $schema;
}
/**
* @addtogroup updates-6.x-to-7.x
* @{
*/
/**
* Update the {accesslog}.sid column to match the length of {sessions}.sid
*/
function statistics_update_7000() {
db_change_field('accesslog', 'sid', 'sid', array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Browser session ID of user that visited page.',
));
}
/**
* @} End of "addtogroup updates-6.x-to-7.x".
*/
|