aggregator.install

  1. 7.x drupal-7.x/modules/aggregator/aggregator.install
  2. 6.x drupal-6.x/modules/aggregator/aggregator.install

File

drupal-6.x/modules/aggregator/aggregator.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function aggregator_install() {
  6. // Create tables.
  7. drupal_install_schema('aggregator');
  8. }
  9. /**
  10. * Implementation of hook_uninstall().
  11. */
  12. function aggregator_uninstall() {
  13. // Remove tables.
  14. drupal_uninstall_schema('aggregator');
  15. variable_del('aggregator_allowed_html_tags');
  16. variable_del('aggregator_summary_items');
  17. variable_del('aggregator_clear');
  18. variable_del('aggregator_category_selector');
  19. }
  20. /**
  21. * Implementation of hook_schema().
  22. */
  23. function aggregator_schema() {
  24. $schema['aggregator_category'] = array(
  25. 'description' => 'Stores categories for aggregator feeds and feed items.',
  26. 'fields' => array(
  27. 'cid' => array(
  28. 'type' => 'serial',
  29. 'not null' => TRUE,
  30. 'description' => 'Primary Key: Unique aggregator category ID.',
  31. ),
  32. 'title' => array(
  33. 'type' => 'varchar',
  34. 'length' => 255,
  35. 'not null' => TRUE,
  36. 'default' => '',
  37. 'description' => 'Title of the category.',
  38. ),
  39. 'description' => array(
  40. 'type' => 'text',
  41. 'not null' => TRUE,
  42. 'size' => 'big',
  43. 'description' => 'Description of the category',
  44. ),
  45. 'block' => array(
  46. 'type' => 'int',
  47. 'not null' => TRUE,
  48. 'default' => 0,
  49. 'size' => 'tiny',
  50. 'description' => 'The number of recent items to show within the category block.',
  51. )
  52. ),
  53. 'primary key' => array('cid'),
  54. 'unique keys' => array('title' => array('title')),
  55. );
  56. $schema['aggregator_category_feed'] = array(
  57. 'description' => 'Bridge table; maps feeds to categories.',
  58. 'fields' => array(
  59. 'fid' => array(
  60. 'type' => 'int',
  61. 'not null' => TRUE,
  62. 'default' => 0,
  63. 'description' => "The feed's {aggregator_feed}.fid.",
  64. ),
  65. 'cid' => array(
  66. 'type' => 'int',
  67. 'not null' => TRUE,
  68. 'default' => 0,
  69. 'description' => 'The {aggregator_category}.cid to which the feed is being assigned.',
  70. )
  71. ),
  72. 'primary key' => array('cid', 'fid'),
  73. 'indexes' => array('fid' => array('fid')),
  74. );
  75. $schema['aggregator_category_item'] = array(
  76. 'description' => 'Bridge table; maps feed items to categories.',
  77. 'fields' => array(
  78. 'iid' => array(
  79. 'type' => 'int',
  80. 'not null' => TRUE,
  81. 'default' => 0,
  82. 'description' => "The feed item's {aggregator_item}.iid.",
  83. ),
  84. 'cid' => array(
  85. 'type' => 'int',
  86. 'not null' => TRUE,
  87. 'default' => 0,
  88. 'description' => 'The {aggregator_category}.cid to which the feed item is being assigned.',
  89. )
  90. ),
  91. 'primary key' => array('cid', 'iid'),
  92. 'indexes' => array('iid' => array('iid')),
  93. );
  94. $schema['aggregator_feed'] = array(
  95. 'description' => 'Stores feeds to be parsed by the aggregator.',
  96. 'fields' => array(
  97. 'fid' => array(
  98. 'type' => 'serial',
  99. 'not null' => TRUE,
  100. 'description' => 'Primary Key: Unique feed ID.',
  101. ),
  102. 'title' => array(
  103. 'type' => 'varchar',
  104. 'length' => 255,
  105. 'not null' => TRUE,
  106. 'default' => '',
  107. 'description' => 'Title of the feed.',
  108. ),
  109. 'url' => array(
  110. 'type' => 'varchar',
  111. 'length' => 255,
  112. 'not null' => TRUE,
  113. 'default' => '',
  114. 'description' => 'URL to the feed.',
  115. ),
  116. 'refresh' => array(
  117. 'type' => 'int',
  118. 'not null' => TRUE,
  119. 'default' => 0,
  120. 'description' => 'How often to check for new feed items, in seconds.',
  121. ),
  122. 'checked' => array(
  123. 'type' => 'int',
  124. 'not null' => TRUE,
  125. 'default' => 0,
  126. 'description' => 'Last time feed was checked for new items, as Unix timestamp.',
  127. ),
  128. 'link' => array(
  129. 'type' => 'varchar',
  130. 'length' => 255,
  131. 'not null' => TRUE,
  132. 'default' => '',
  133. 'description' => 'The parent website of the feed; comes from the &lt;link&gt; element in the feed.',
  134. ),
  135. 'description' => array(
  136. 'type' => 'text',
  137. 'not null' => TRUE,
  138. 'size' => 'big',
  139. 'description' => "The parent website's description; comes from the &lt;description&gt; element in the feed.",
  140. ),
  141. 'image' => array(
  142. 'type' => 'text',
  143. 'not null' => TRUE,
  144. 'size' => 'big',
  145. 'description' => 'An image representing the feed.',
  146. ),
  147. 'etag' => array(
  148. 'type' => 'varchar',
  149. 'length' => 255,
  150. 'not null' => TRUE,
  151. 'default' => '',
  152. 'description' => 'Entity tag HTTP response header, used for validating cache.',
  153. ),
  154. 'modified' => array(
  155. 'type' => 'int',
  156. 'not null' => TRUE,
  157. 'default' => 0,
  158. 'description' => 'When the feed was last modified, as a Unix timestamp.',
  159. ),
  160. 'block' => array(
  161. 'type' => 'int',
  162. 'not null' => TRUE,
  163. 'default' => 0,
  164. 'size' => 'tiny',
  165. 'description' => "Number of items to display in the feed's block.",
  166. )
  167. ),
  168. 'primary key' => array('fid'),
  169. 'unique keys' => array(
  170. 'url' => array('url'),
  171. 'title' => array('title'),
  172. ),
  173. );
  174. $schema['aggregator_item'] = array(
  175. 'description' => 'Stores the individual items imported from feeds.',
  176. 'fields' => array(
  177. 'iid' => array(
  178. 'type' => 'serial',
  179. 'not null' => TRUE,
  180. 'description' => 'Primary Key: Unique ID for feed item.',
  181. ),
  182. 'fid' => array(
  183. 'type' => 'int',
  184. 'not null' => TRUE,
  185. 'default' => 0,
  186. 'description' => 'The {aggregator_feed}.fid to which this item belongs.',
  187. ),
  188. 'title' => array(
  189. 'type' => 'varchar',
  190. 'length' => 255,
  191. 'not null' => TRUE,
  192. 'default' => '',
  193. 'description' => 'Title of the feed item.',
  194. ),
  195. 'link' => array(
  196. 'type' => 'varchar',
  197. 'length' => 255,
  198. 'not null' => TRUE,
  199. 'default' => '',
  200. 'description' => 'Link to the feed item.',
  201. ),
  202. 'author' => array(
  203. 'type' => 'varchar',
  204. 'length' => 255,
  205. 'not null' => TRUE,
  206. 'default' => '',
  207. 'description' => 'Author of the feed item.',
  208. ),
  209. 'description' => array(
  210. 'type' => 'text',
  211. 'not null' => TRUE,
  212. 'size' => 'big',
  213. 'description' => 'Body of the feed item.',
  214. ),
  215. 'timestamp' => array(
  216. 'type' => 'int',
  217. 'not null' => FALSE,
  218. 'description' => 'Post date of feed item, as a Unix timestamp.',
  219. ),
  220. 'guid' => array(
  221. 'type' => 'varchar',
  222. 'length' => 255,
  223. 'not null' => FALSE,
  224. 'description' => 'Unique identifier for the feed item.',
  225. )
  226. ),
  227. 'primary key' => array('iid'),
  228. 'indexes' => array('fid' => array('fid')),
  229. );
  230. return $schema;
  231. }