| Line # | Frequency | Source Line | | 1 | | <?php | | 2 | | // $Id: dblog.install,v 1.7 2008/03/15 12:31:28 dries Exp $ | | 3 | | | | 4 | | /** | | 5 | | * Implementation of hook_install(). | | 6 | | */ | | 7 | | function dblog_install() { | | 8 | | // Create tables. | | 9 | 1 | 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 | 1 | 'description' => t('Table that contains logs of all system events.'), | | 26 | | 'fields' => array( | | 27 | | 'wid' => array( | | 28 | | 'type' => 'serial', | | 29 | | 'not null' => TRUE, | | 30 | | 'description' => t('Primary Key: Unique watchdog event ID.'), | | 31 | | ), | | 32 | | 'uid' => array( | | 33 | | 'type' => 'int', | | 34 | | 'not null' => TRUE, | | 35 | | 'default' => 0, | | 36 | | 'description' => t('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' => t('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' => t('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' => t('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' => t('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' => t('Link to view the result of the event.'), | | 71 | | ), | | 72 | | 'location' => array( | | 73 | | 'type' => 'text', | | 74 | | 'not null' => TRUE, | | 75 | | 'description' => t('URL of the origin of the event.'), | | 76 | | ), | | 77 | | 'referer' => array( | | 78 | | 'type' => 'varchar', | | 79 | | 'length' => 128, | | 80 | | 'not null' => TRUE, | | 81 | | 'default' => '', | | 82 | | 'description' => t('URL of referring page.'), | | 83 | | ), | | 84 | | 'hostname' => array( | | 85 | | 'type' => 'varchar', | | 86 | | 'length' => 128, | | 87 | | 'not null' => TRUE, | | 88 | | 'default' => '', | | 89 | | 'description' => t('Hostname of the user who triggered the event.'), | | 90 | | ), | | 91 | | 'timestamp' => array( | | 92 | | 'type' => 'int', | | 93 | | 'not null' => TRUE, | | 94 | | 'default' => 0, | | 95 | | 'description' => t('Unix timestamp of when event occurred.'), | | 96 | | ), | | 97 | | ), | | 98 | | 'primary key' => array('wid'), | | 99 | | 'indexes' => array( | | 100 | | 'type' => array('type'), | | 101 | | ), | | 102 | | ); | | 103 | | | | 104 | 1 | return $schema; | | 105 | | } |
|