View source
<?php
function filelog_ui_schema() {
$schema['filelog'] = array(
'description' => 'Table that contains logs of all system events.',
'fields' => array(
'wid' => array(
'type' => 'char',
'length' => 32,
'not null' => TRUE,
'description' => 'Primary Key: Unique watchdog event ID.',
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the user who triggered the event.',
),
'type' => array(
'type' => 'varchar',
'length' => 16,
'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' => 'text',
'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' => TRUE,
'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',
'timestamp',
),
'severity' => array(
'severity',
'timestamp',
),
'hostname' => array(
'hostname',
'timestamp',
),
'referer' => array(
'timestamp',
array(
'referer',
256,
),
),
),
);
return $schema;
}
function filelog_ui_install() {
drupal_install_schema('filelog_ui');
}
function filelog_ui_uninstall() {
drupal_uninstall_schema('filelog_ui');
$vars = array(
'filelog_maxage',
'filelog_import_frequency',
'filelog_last_import',
'filelog_check_base_url',
);
foreach ($vars as $var) {
db_query("DELETE FROM {variable} WHERE name = '%s'", $var);
unset($conf[$var]);
}
cache_clear_all('variables', 'cache');
cache_clear_all('filelog', 'cache', TRUE);
}
function filelog_ui_enable() {
batch_set(array(
'title' => t('Importing log entries'),
'operations' => array(
array(
'filelog_ui_import_entries',
array(),
),
array(
'cache_clear_all',
array(
'filelog_type_registry',
'cache',
FALSE,
),
),
),
'file' => drupal_get_path('module', 'filelog_ui') . '/filelog_ui.admin.inc',
));
}