[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/modules/dblog/ -> dblog.install (source)

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


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7