Code coverage for /20081101/modules/dblog/dblog.install

Line #Times calledCode
1
<?php
2
// $Id: dblog.install,v 1.9 2008/10/22 18:32:31 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
712
function dblog_install() {
8
  // Create tables.
9134
  drupal_install_schema('dblog');
10134
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
1512
function dblog_uninstall() {
16
  // Remove tables.
170
  drupal_uninstall_schema('dblog');
180
}
19
20
/**
21
 * Implementation of hook_schema().
22
 */
2312
function dblog_schema() {
24134
  $schema['watchdog'] = array(
25134
    'description' => t('Table that contains logs of all system events.'),
26
    'fields' => array(
27
      'wid' => array(
28134
        'type' => 'serial',
29134
        'not null' => TRUE,
30134
        'description' => t('Primary Key: Unique watchdog event ID.'),
31134
      ),
32
      'uid' => array(
33134
        'type' => 'int',
34134
        'not null' => TRUE,
35134
        'default' => 0,
36134
        'description' => t('The {users}.uid of the user who triggered the
event.'),
37134
      ),
38
      'type' => array(
39134
        'type' => 'varchar',
40134
        'length' => 16,
41134
        'not null' => TRUE,
42134
        'default' => '',
43134
        'description' => t('Type of log message, for example "user" or
"page not found."'),
44134
      ),
45
      'message' => array(
46134
        'type' => 'text',
47134
        'not null' => TRUE,
48134
        'size' => 'big',
49134
        'description' => t('Text of log message to be passed into the t()
function.'),
50134
      ),
51
      'variables' => array(
52134
        'type' => 'text',
53134
        'not null' => TRUE,
54134
        'size' => 'big',
55134
        'description' => t('Serialized array of variables that match the
message string and that is passed into the t() function.'),
56134
      ),
57
      'severity' => array(
58134
        'type' => 'int',
59134
        'unsigned' => TRUE,
60134
        'not null' => TRUE,
61134
        'default' => 0,
62134
        'size' => 'tiny',
63134
        'description' => t('The severity level of the event; ranges from 0
(Emergency) to 7 (Debug)'),
64134
      ),
65
      'link' => array(
66134
        'type' => 'varchar',
67134
        'length' => 255,
68134
        'not null' => FALSE,
69134
        'default' => '',
70134
        'description' => t('Link to view the result of the event.'),
71134
      ),
72
      'location'  => array(
73134
        'type' => 'text',
74134
        'not null' => TRUE,
75134
        'description' => t('URL of the origin of the event.'),
76134
      ),
77
      'referer' => array(
78134
        'type' => 'varchar',
79134
        'length' => 128,
80134
        'not null' => FALSE,
81134
        'default' => '',
82134
        'description' => t('URL of referring page.'),
83134
      ),
84
      'hostname' => array(
85134
        'type' => 'varchar',
86134
        'length' => 128,
87134
        'not null' => TRUE,
88134
        'default' => '',
89134
        'description' => t('Hostname of the user who triggered the
event.'),
90134
      ),
91
      'timestamp' => array(
92134
        'type' => 'int',
93134
        'not null' => TRUE,
94134
        'default' => 0,
95134
        'description' => t('Unix timestamp of when event occurred.'),
96134
      ),
97134
    ),
98134
    'primary key' => array('wid'),
99
    'indexes' => array(
100134
      'type' => array('type'),
101134
      'uid' => array('uid'),
102134
    ),
103
  );
104
105134
  return $schema;
1060
}
107
108
/**
109
 * Allow NULL values for links.
110
 */
11112
function dblog_update_7001() {
1120
  $ret = array();
1130
  db_change_field($ret, 'watchdog', 'link', 'link', array('type' =>
'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
1140
  db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' =>
'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
1150
  return $ret;
1160
}
117
118
/**
119
 * Add index on uid.
120
 */
12112
function dblog_update_7002() {
1220
  $ret = array();
1230
  db_add_index($ret, 'watchdog', 'uid', array('uid'));
1240
  return $ret;
1250
}
12612