Install, update and uninstall functions for the dblog module.
<?php
/**
* @file
* Install, update and uninstall functions for the dblog module.
*/
/**
* Implements hook_schema().
*/
function dblog_schema() {
$schema['watchdog'] = array(
'description' => 'Table that contains logs of all system events.',
'fields' => array(
'wid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique watchdog event ID.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the user who triggered the event.',
),
'type' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Type of log message, for example "user" or "page not found."',
),
'message' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Text of log message to be passed into the t() function.',
),
'variables' => array(
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
),
'severity' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
),
'link' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
'description' => 'Link to view the result of the event.',
),
'location' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'URL of the origin of the event.',
),
'referer' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'URL of referring page.',
),
'hostname' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Hostname of the user who triggered the event.',
),
'timestamp' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp of when event occurred.',
),
),
'primary key' => array(
'wid',
),
'indexes' => array(
'type' => array(
'type',
),
'uid' => array(
'uid',
),
'severity' => array(
'severity',
),
),
);
return $schema;
}
/**
* @addtogroup updates-7.x-to-8.x
* @{
*/
/**
* Update settings to the new configuration system.
*/
function dblog_update_8000() {
update_variables_to_config('dblog.settings', array(
'dblog_row_limit' => 'row_limit',
));
}
/**
* Make *id fields unsigned.
*/
function dblog_update_8001() {
db_drop_index('watchdog', 'uid');
db_change_field('watchdog', 'uid', 'uid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the user who triggered the event.',
), array(
'indexes' => array(
'uid' => array(
'uid',
),
),
));
}
/**
* @} End of "addtogroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
*/
Name | Description |
---|---|
dblog_schema | Implements hook_schema(). |
dblog_update_8000 | Update settings to the new configuration system. |
dblog_update_8001 | Make *id fields unsigned. |