/[drupal]/drupal/modules/statistics/statistics.install
ViewVC logotype

Contents of /drupal/modules/statistics/statistics.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.24 - (show annotations) (download) (as text)
Sat Oct 17 12:07:31 2009 UTC (5 weeks, 6 days ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.23: +14 -3 lines
File MIME type: text/x-php
- Patch #278592 by catch, Dave Reid, andypost, lilou, sun, tobiasb: sync 6.x extra updates with HEAD.
1 <?php
2 // $Id: statistics.install,v 1.23 2009/09/29 15:13:56 dries Exp $
3
4 /**
5 * @file
6 * Install, update and uninstall functions for the statistics module.
7 */
8
9 /**
10 * Implement hook_uninstall().
11 */
12 function statistics_uninstall() {
13 // Remove variables.
14 variable_del('statistics_count_content_views');
15 variable_del('statistics_enable_access_log');
16 variable_del('statistics_flush_accesslog_timer');
17 variable_del('statistics_day_timestamp');
18 variable_del('statistics_block_top_day_num');
19 variable_del('statistics_block_top_all_num');
20 variable_del('statistics_block_top_last_num');
21 }
22
23 /**
24 * Implement hook_schema().
25 */
26 function statistics_schema() {
27 $schema['accesslog'] = array(
28 'description' => 'Stores site access information for statistics.',
29 'fields' => array(
30 'aid' => array(
31 'type' => 'serial',
32 'not null' => TRUE,
33 'description' => 'Primary Key: Unique accesslog ID.',
34 ),
35 'sid' => array(
36 'type' => 'varchar',
37 'length' => 64,
38 'not null' => TRUE,
39 'default' => '',
40 'description' => 'Browser session ID of user that visited page.',
41 ),
42 'title' => array(
43 'type' => 'varchar',
44 'length' => 255,
45 'not null' => FALSE,
46 'description' => 'Title of page visited.',
47 ),
48 'path' => array(
49 'type' => 'varchar',
50 'length' => 255,
51 'not null' => FALSE,
52 'description' => 'Internal path to page visited (relative to Drupal root.)',
53 ),
54 'url' => array(
55 'type' => 'text',
56 'not null' => FALSE,
57 'description' => 'Referrer URI.',
58 ),
59 'hostname' => array(
60 'type' => 'varchar',
61 'length' => 128,
62 'not null' => FALSE,
63 'description' => 'Hostname of user that visited the page.',
64 ),
65 'uid' => array(
66 'type' => 'int',
67 'unsigned' => TRUE,
68 'not null' => FALSE,
69 'default' => 0,
70 'description' => 'User {users}.uid that visited the page.',
71 ),
72 'timer' => array(
73 'type' => 'int',
74 'unsigned' => TRUE,
75 'not null' => TRUE,
76 'default' => 0,
77 'description' => 'Time in milliseconds that the page took to load.',
78 ),
79 'timestamp' => array(
80 'type' => 'int',
81 'unsigned' => TRUE,
82 'not null' => TRUE,
83 'default' => 0,
84 'description' => 'Timestamp of when the page was visited.',
85 ),
86 ),
87 'indexes' => array(
88 'accesslog_timestamp' => array('timestamp'),
89 'uid' => array('uid'),
90 ),
91 'primary key' => array('aid'),
92 'foreign keys' => array(
93 'uid' => array('users' => 'uid'),
94 ),
95 );
96
97 $schema['node_counter'] = array(
98 'description' => 'Access statistics for {node}s.',
99 'fields' => array(
100 'nid' => array(
101 'description' => 'The {node}.nid for these statistics.',
102 'type' => 'int',
103 'not null' => TRUE,
104 'default' => 0,
105 ),
106 'totalcount' => array(
107 'description' => 'The total number of times the {node} has been viewed.',
108 'type' => 'int',
109 'unsigned' => TRUE,
110 'not null' => TRUE,
111 'default' => 0,
112 'size' => 'big',
113 ),
114 'daycount' => array(
115 'description' => 'The total number of times the {node} has been viewed today.',
116 'type' => 'int',
117 'unsigned' => TRUE,
118 'not null' => TRUE,
119 'default' => 0,
120 'size' => 'medium',
121 ),
122 'timestamp' => array(
123 'description' => 'The most recent time the {node} has been viewed.',
124 'type' => 'int',
125 'unsigned' => TRUE,
126 'not null' => TRUE,
127 'default' => 0,
128 ),
129 ),
130 'primary key' => array('nid'),
131 );
132
133 return $schema;
134 }
135
136 /**
137 * @defgroup updates-6.x-extra Extra statistics updates for 6.x
138 * @{
139 */
140
141 /**
142 * Allow longer referrers.
143 */
144 function statistics_update_6000() {
145 db_change_field('accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE));
146 }
147
148 /**
149 * @} End of "defgroup updates-6.x-extra"
150 * The next series of updates should start at 7000.
151 */
152
153
154 /**
155 * @defgroup updates-6.x-to-7.x statistics updates from 6.x to 7.x
156 * @{
157 */
158
159 /**
160 * @} End of "defgroup updates-6.x-to-7.x"
161 * The next series of updates should start at 8000.
162 */

  ViewVC Help
Powered by ViewVC 1.1.2