Drupal investigation

dblog.install 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the dblog module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function dblog_schema() {
  10. $schema['watchdog'] = [
  11. 'description' => 'Table that contains logs of all system events.',
  12. 'fields' => [
  13. 'wid' => [
  14. 'type' => 'serial',
  15. 'not null' => TRUE,
  16. 'description' => 'Primary Key: Unique watchdog event ID.',
  17. ],
  18. 'uid' => [
  19. 'type' => 'int',
  20. 'unsigned' => TRUE,
  21. 'not null' => TRUE,
  22. 'default' => 0,
  23. 'description' => 'The {users}.uid of the user who triggered the event.',
  24. ],
  25. 'type' => [
  26. 'type' => 'varchar_ascii',
  27. 'length' => 64,
  28. 'not null' => TRUE,
  29. 'default' => '',
  30. 'description' => 'Type of log message, for example "user" or "page not found."',
  31. ],
  32. 'message' => [
  33. 'type' => 'text',
  34. 'not null' => TRUE,
  35. 'size' => 'big',
  36. 'description' => 'Text of log message to be passed into the t() function.',
  37. ],
  38. 'variables' => [
  39. 'type' => 'blob',
  40. 'not null' => TRUE,
  41. 'size' => 'big',
  42. 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
  43. ],
  44. 'severity' => [
  45. 'type' => 'int',
  46. 'unsigned' => TRUE,
  47. 'not null' => TRUE,
  48. 'default' => 0,
  49. 'size' => 'tiny',
  50. 'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
  51. ],
  52. 'link' => [
  53. 'type' => 'text',
  54. 'not null' => FALSE,
  55. 'description' => 'Link to view the result of the event.',
  56. ],
  57. 'location' => [
  58. 'type' => 'text',
  59. 'not null' => TRUE,
  60. 'description' => 'URL of the origin of the event.',
  61. ],
  62. 'referer' => [
  63. 'type' => 'text',
  64. 'not null' => FALSE,
  65. 'description' => 'URL of referring page.',
  66. ],
  67. 'hostname' => [
  68. 'type' => 'varchar_ascii',
  69. 'length' => 128,
  70. 'not null' => TRUE,
  71. 'default' => '',
  72. 'description' => 'Hostname of the user who triggered the event.',
  73. ],
  74. 'timestamp' => [
  75. 'type' => 'int',
  76. 'not null' => TRUE,
  77. 'default' => 0,
  78. 'description' => 'Unix timestamp of when event occurred.',
  79. ],
  80. ],
  81. 'primary key' => ['wid'],
  82. 'indexes' => [
  83. 'type' => ['type'],
  84. 'uid' => ['uid'],
  85. 'severity' => ['severity'],
  86. ],
  87. ];
  88. return $schema;
  89. }