| Drupal | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /** 4 * @file 5 * Install, update and uninstall functions for the dblog module. 6 */ 7 8 /** 9 * Implements hook_schema(). 10 */ 11 function dblog_schema() { 12 $schema['watchdog'] = array( 13 'description' => 'Table that contains logs of all system events.', 14 'fields' => array( 15 'wid' => array( 16 'type' => 'serial', 17 'not null' => TRUE, 18 'description' => 'Primary Key: Unique watchdog event ID.', 19 ), 20 'uid' => array( 21 'type' => 'int', 22 'not null' => TRUE, 23 'default' => 0, 24 'description' => 'The {users}.uid of the user who triggered the event.', 25 ), 26 'type' => array( 27 'type' => 'varchar', 28 'length' => 64, 29 'not null' => TRUE, 30 'default' => '', 31 'description' => 'Type of log message, for example "user" or "page not found."', 32 ), 33 'message' => array( 34 'type' => 'text', 35 'not null' => TRUE, 36 'size' => 'big', 37 'description' => 'Text of log message to be passed into the t() function.', 38 ), 39 'variables' => array( 40 'type' => 'blob', 41 'not null' => TRUE, 42 'size' => 'big', 43 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.', 44 ), 45 'severity' => array( 46 'type' => 'int', 47 'unsigned' => TRUE, 48 'not null' => TRUE, 49 'default' => 0, 50 'size' => 'tiny', 51 'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)', 52 ), 53 'link' => array( 54 'type' => 'varchar', 55 'length' => 255, 56 'not null' => FALSE, 57 'default' => '', 58 'description' => 'Link to view the result of the event.', 59 ), 60 'location' => array( 61 'type' => 'text', 62 'not null' => TRUE, 63 'description' => 'URL of the origin of the event.', 64 ), 65 'referer' => array( 66 'type' => 'text', 67 'not null' => FALSE, 68 'description' => 'URL of referring page.', 69 ), 70 'hostname' => array( 71 'type' => 'varchar', 72 'length' => 128, 73 'not null' => TRUE, 74 'default' => '', 75 'description' => 'Hostname of the user who triggered the event.', 76 ), 77 'timestamp' => array( 78 'type' => 'int', 79 'not null' => TRUE, 80 'default' => 0, 81 'description' => 'Unix timestamp of when event occurred.', 82 ), 83 ), 84 'primary key' => array('wid'), 85 'indexes' => array( 86 'type' => array('type'), 87 'uid' => array('uid'), 88 ), 89 ); 90 91 return $schema; 92 } 93 94 /** 95 * Implements hook_uninstall(). 96 */ 97 function dblog_uninstall() { 98 variable_del('dblog_row_limit'); 99 } 100 101 /** 102 * @addtogroup updates-6.x-to-7.x 103 * @{ 104 */ 105 106 /** 107 * Update the {watchdog} table. 108 */ 109 function dblog_update_7001() { 110 // Allow NULL values for links. 111 db_change_field('watchdog', 'link', 'link', array( 112 'type' => 'varchar', 113 'length' => 255, 114 'not null' => FALSE, 115 'default' => '', 116 'description' => 'Link to view the result of the event.', 117 )); 118 119 // Add an index on uid. 120 db_add_index('watchdog', 'uid', array('uid')); 121 122 // Allow longer type values. 123 db_change_field('watchdog', 'type', 'type', array( 124 'type' => 'varchar', 125 'length' => 64, 126 'not null' => TRUE, 127 'default' => '', 128 'description' => 'Type of log message, for example "user" or "page not found."', 129 )); 130 131 // Convert the variables field (that stores serialized variables) from text to blob. 132 db_change_field('watchdog', 'variables', 'variables', array( 133 'type' => 'blob', 134 'not null' => TRUE, 135 'size' => 'big', 136 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.', 137 )); 138 } 139 140 /** 141 * @} End of "addtogroup updates-6.x-to-7.x". 142 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title