webmaster@1
|
1 <?php |
franck@19
|
2 // $Id: dblog.install,v 1.6.2.1 2009/01/06 15:46:36 goba Exp $ |
webmaster@1
|
3 |
webmaster@1
|
4 /** |
webmaster@1
|
5 * Implementation of hook_install(). |
webmaster@1
|
6 */ |
webmaster@1
|
7 function dblog_install() { |
webmaster@1
|
8 // Create tables. |
webmaster@1
|
9 drupal_install_schema('dblog'); |
webmaster@1
|
10 } |
webmaster@1
|
11 |
webmaster@1
|
12 /** |
webmaster@1
|
13 * Implementation of hook_uninstall(). |
webmaster@1
|
14 */ |
webmaster@1
|
15 function dblog_uninstall() { |
webmaster@1
|
16 // Remove tables. |
webmaster@1
|
17 drupal_uninstall_schema('dblog'); |
webmaster@1
|
18 } |
webmaster@1
|
19 |
webmaster@1
|
20 /** |
webmaster@1
|
21 * Implementation of hook_schema(). |
webmaster@1
|
22 */ |
webmaster@1
|
23 function dblog_schema() { |
webmaster@1
|
24 $schema['watchdog'] = array( |
franck@19
|
25 'description' => 'Table that contains logs of all system events.', |
webmaster@1
|
26 'fields' => array( |
webmaster@1
|
27 'wid' => array( |
webmaster@1
|
28 'type' => 'serial', |
webmaster@1
|
29 'not null' => TRUE, |
franck@19
|
30 'description' => 'Primary Key: Unique watchdog event ID.', |
webmaster@1
|
31 ), |
webmaster@1
|
32 'uid' => array( |
webmaster@1
|
33 'type' => 'int', |
webmaster@1
|
34 'not null' => TRUE, |
webmaster@1
|
35 'default' => 0, |
franck@19
|
36 'description' => 'The {users}.uid of the user who triggered the event.', |
webmaster@1
|
37 ), |
webmaster@1
|
38 'type' => array( |
webmaster@1
|
39 'type' => 'varchar', |
webmaster@1
|
40 'length' => 16, |
webmaster@1
|
41 'not null' => TRUE, |
webmaster@1
|
42 'default' => '', |
franck@19
|
43 'description' => 'Type of log message, for example "user" or "page not found."', |
webmaster@1
|
44 ), |
webmaster@1
|
45 'message' => array( |
webmaster@1
|
46 'type' => 'text', |
webmaster@1
|
47 'not null' => TRUE, |
webmaster@1
|
48 'size' => 'big', |
franck@19
|
49 'description' => 'Text of log message to be passed into the t() function.', |
webmaster@1
|
50 ), |
webmaster@1
|
51 'variables' => array( |
webmaster@1
|
52 'type' => 'text', |
webmaster@1
|
53 'not null' => TRUE, |
webmaster@1
|
54 'size' => 'big', |
franck@19
|
55 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.', |
webmaster@1
|
56 ), |
webmaster@1
|
57 'severity' => array( |
webmaster@1
|
58 'type' => 'int', |
webmaster@1
|
59 'unsigned' => TRUE, |
webmaster@1
|
60 'not null' => TRUE, |
webmaster@1
|
61 'default' => 0, |
webmaster@1
|
62 'size' => 'tiny', |
franck@19
|
63 'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)', |
webmaster@1
|
64 ), |
webmaster@1
|
65 'link' => array( |
webmaster@1
|
66 'type' => 'varchar', |
webmaster@1
|
67 'length' => 255, |
webmaster@1
|
68 'not null' => TRUE, |
webmaster@1
|
69 'default' => '', |
franck@19
|
70 'description' => 'Link to view the result of the event.', |
webmaster@1
|
71 ), |
webmaster@1
|
72 'location' => array( |
webmaster@1
|
73 'type' => 'text', |
webmaster@1
|
74 'not null' => TRUE, |
franck@19
|
75 'description' => 'URL of the origin of the event.', |
webmaster@1
|
76 ), |
webmaster@1
|
77 'referer' => array( |
webmaster@1
|
78 'type' => 'varchar', |
webmaster@1
|
79 'length' => 128, |
webmaster@1
|
80 'not null' => TRUE, |
webmaster@1
|
81 'default' => '', |
franck@19
|
82 'description' => 'URL of referring page.', |
webmaster@1
|
83 ), |
webmaster@1
|
84 'hostname' => array( |
webmaster@1
|
85 'type' => 'varchar', |
webmaster@1
|
86 'length' => 128, |
webmaster@1
|
87 'not null' => TRUE, |
webmaster@1
|
88 'default' => '', |
franck@19
|
89 'description' => 'Hostname of the user who triggered the event.', |
webmaster@1
|
90 ), |
webmaster@1
|
91 'timestamp' => array( |
webmaster@1
|
92 'type' => 'int', |
webmaster@1
|
93 'not null' => TRUE, |
webmaster@1
|
94 'default' => 0, |
franck@19
|
95 'description' => 'Unix timestamp of when event occurred.', |
webmaster@1
|
96 ), |
webmaster@1
|
97 ), |
webmaster@1
|
98 'primary key' => array('wid'), |
webmaster@1
|
99 'indexes' => array('type' => array('type')), |
webmaster@1
|
100 ); |
webmaster@1
|
101 |
webmaster@1
|
102 return $schema; |
webmaster@1
|
103 } |
webmaster@1
|
104 |