1. 8.5.x core/modules/dblog/dblog.install
  2. 8.0.x core/modules/dblog/dblog.install
  3. 8.1.x core/modules/dblog/dblog.install
  4. 8.2.x core/modules/dblog/dblog.install
  5. 8.3.x core/modules/dblog/dblog.install
  6. 8.4.x core/modules/dblog/dblog.install
  7. 8.6.x core/modules/dblog/dblog.install
  8. 6.x modules/dblog/dblog.install
  9. 7.x modules/dblog/dblog.install

File

modules/dblog/dblog.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function dblog_install() {

  // Create tables.
  drupal_install_schema('dblog');
}

/**
 * Implementation of hook_uninstall().
 */
function dblog_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('dblog');
}

/**
 * Implementation of 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',
        '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',
      ),
    ),
  );
  return $schema;
}

/**
 * @addtogroup updates-6.x-extra
 * @{
 */

/**
 * Allow longer referrers.
 */
function dblog_update_6000() {
  $ret = array();
  db_change_field($ret, 'watchdog', 'referer', 'referer', array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  return $ret;
}

/**
 * @} End of "addtogroup updates-6.x-extra".
 * The next series of updates should start at 7000.
 */

Functions

Namesort descending Description
dblog_install Implementation of hook_install().
dblog_schema Implementation of hook_schema().
dblog_uninstall Implementation of hook_uninstall().
dblog_update_6000 Allow longer referrers.