1. 8.2.x core/modules/aggregator/aggregator.install
  2. 8.0.x core/modules/aggregator/aggregator.install
  3. 8.1.x core/modules/aggregator/aggregator.install
  4. 8.3.x core/modules/aggregator/aggregator.install
  5. 5.x modules/aggregator/aggregator.install
  6. 6.x modules/aggregator/aggregator.install
  7. 7.x modules/aggregator/aggregator.install

Install, update and uninstall functions for the aggregator module.

File

modules/aggregator/aggregator.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the aggregator module.
  5. */
  6. /**
  7. * Implements hook_uninstall().
  8. */
  9. function aggregator_uninstall() {
  10. variable_del('aggregator_allowed_html_tags');
  11. variable_del('aggregator_summary_items');
  12. variable_del('aggregator_clear');
  13. variable_del('aggregator_category_selector');
  14. variable_del('aggregator_fetcher');
  15. variable_del('aggregator_parser');
  16. variable_del('aggregator_processors');
  17. variable_del('aggregator_teaser_length');
  18. }
  19. /**
  20. * Implements hook_schema().
  21. */
  22. function aggregator_schema() {
  23. $schema['aggregator_category'] = array(
  24. 'description' => 'Stores categories for aggregator feeds and feed items.',
  25. 'fields' => array(
  26. 'cid' => array(
  27. 'type' => 'serial',
  28. 'not null' => TRUE,
  29. 'description' => 'Primary Key: Unique aggregator category ID.',
  30. ),
  31. 'title' => array(
  32. 'type' => 'varchar',
  33. 'length' => 255,
  34. 'not null' => TRUE,
  35. 'default' => '',
  36. 'description' => 'Title of the category.',
  37. ),
  38. 'description' => array(
  39. 'type' => 'text',
  40. 'not null' => TRUE,
  41. 'size' => 'big',
  42. 'description' => 'Description of the category',
  43. ),
  44. 'block' => array(
  45. 'type' => 'int',
  46. 'not null' => TRUE,
  47. 'default' => 0,
  48. 'size' => 'tiny',
  49. 'description' => 'The number of recent items to show within the category block.',
  50. )
  51. ),
  52. 'primary key' => array('cid'),
  53. 'unique keys' => array(
  54. 'title' => array('title'),
  55. ),
  56. );
  57. $schema['aggregator_category_feed'] = array(
  58. 'description' => 'Bridge table; maps feeds to categories.',
  59. 'fields' => array(
  60. 'fid' => array(
  61. 'type' => 'int',
  62. 'not null' => TRUE,
  63. 'default' => 0,
  64. 'description' => "The feed's {aggregator_feed}.fid.",
  65. ),
  66. 'cid' => array(
  67. 'type' => 'int',
  68. 'not null' => TRUE,
  69. 'default' => 0,
  70. 'description' => 'The {aggregator_category}.cid to which the feed is being assigned.',
  71. )
  72. ),
  73. 'primary key' => array('cid', 'fid'),
  74. 'indexes' => array(
  75. 'fid' => array('fid'),
  76. ),
  77. 'foreign keys' => array(
  78. 'aggregator_category' => array(
  79. 'table' => 'aggregator_category',
  80. 'columns' => array('cid' => 'cid'),
  81. ),
  82. ),
  83. );
  84. $schema['aggregator_category_item'] = array(
  85. 'description' => 'Bridge table; maps feed items to categories.',
  86. 'fields' => array(
  87. 'iid' => array(
  88. 'type' => 'int',
  89. 'not null' => TRUE,
  90. 'default' => 0,
  91. 'description' => "The feed item's {aggregator_item}.iid.",
  92. ),
  93. 'cid' => array(
  94. 'type' => 'int',
  95. 'not null' => TRUE,
  96. 'default' => 0,
  97. 'description' => 'The {aggregator_category}.cid to which the feed item is being assigned.',
  98. )
  99. ),
  100. 'primary key' => array('cid', 'iid'),
  101. 'indexes' => array(
  102. 'iid' => array('iid'),
  103. ),
  104. 'foreign keys' => array(
  105. 'aggregator_category' => array(
  106. 'table' => 'aggregator_category',
  107. 'columns' => array('cid' => 'cid'),
  108. ),
  109. ),
  110. );
  111. $schema['aggregator_feed'] = array(
  112. 'description' => 'Stores feeds to be parsed by the aggregator.',
  113. 'fields' => array(
  114. 'fid' => array(
  115. 'type' => 'serial',
  116. 'not null' => TRUE,
  117. 'description' => 'Primary Key: Unique feed ID.',
  118. ),
  119. 'title' => array(
  120. 'type' => 'varchar',
  121. 'length' => 255,
  122. 'not null' => TRUE,
  123. 'default' => '',
  124. 'description' => 'Title of the feed.',
  125. ),
  126. 'url' => array(
  127. 'type' => 'text',
  128. 'not null' => TRUE,
  129. 'description' => 'URL to the feed.',
  130. ),
  131. 'refresh' => array(
  132. 'type' => 'int',
  133. 'not null' => TRUE,
  134. 'default' => 0,
  135. 'description' => 'How often to check for new feed items, in seconds.',
  136. ),
  137. 'checked' => array(
  138. 'type' => 'int',
  139. 'not null' => TRUE,
  140. 'default' => 0,
  141. 'description' => 'Last time feed was checked for new items, as Unix timestamp.',
  142. ),
  143. 'queued' => array(
  144. 'type' => 'int',
  145. 'not null' => TRUE,
  146. 'default' => 0,
  147. 'description' => 'Time when this feed was queued for refresh, 0 if not queued.',
  148. ),
  149. 'link' => array(
  150. 'type' => 'text',
  151. 'not null' => TRUE,
  152. 'description' => 'The parent website of the feed; comes from the <link> element in the feed.',
  153. ),
  154. 'description' => array(
  155. 'type' => 'text',
  156. 'not null' => TRUE,
  157. 'size' => 'big',
  158. 'description' => "The parent website's description; comes from the <description> element in the feed.",
  159. ),
  160. 'image' => array(
  161. 'type' => 'text',
  162. 'not null' => TRUE,
  163. 'size' => 'big',
  164. 'description' => 'An image representing the feed.',
  165. ),
  166. 'hash' => array(
  167. 'type' => 'varchar',
  168. 'length' => 64,
  169. 'not null' => TRUE,
  170. 'default' => '',
  171. 'description' => 'Calculated hash of the feed data, used for validating cache.',
  172. ),
  173. 'etag' => array(
  174. 'type' => 'varchar',
  175. 'length' => 255,
  176. 'not null' => TRUE,
  177. 'default' => '',
  178. 'description' => 'Entity tag HTTP response header, used for validating cache.',
  179. ),
  180. 'modified' => array(
  181. 'type' => 'int',
  182. 'not null' => TRUE,
  183. 'default' => 0,
  184. 'description' => 'When the feed was last modified, as a Unix timestamp.',
  185. ),
  186. 'block' => array(
  187. 'type' => 'int',
  188. 'not null' => TRUE,
  189. 'default' => 0,
  190. 'size' => 'tiny',
  191. 'description' => "Number of items to display in the feed's block.",
  192. )
  193. ),
  194. 'primary key' => array('fid'),
  195. 'indexes' => array(
  196. 'url' => array(array('url', 255)),
  197. 'queued' => array('queued'),
  198. ),
  199. 'unique keys' => array(
  200. 'title' => array('title'),
  201. ),
  202. );
  203. $schema['aggregator_item'] = array(
  204. 'description' => 'Stores the individual items imported from feeds.',
  205. 'fields' => array(
  206. 'iid' => array(
  207. 'type' => 'serial',
  208. 'not null' => TRUE,
  209. 'description' => 'Primary Key: Unique ID for feed item.',
  210. ),
  211. 'fid' => array(
  212. 'type' => 'int',
  213. 'not null' => TRUE,
  214. 'default' => 0,
  215. 'description' => 'The {aggregator_feed}.fid to which this item belongs.',
  216. ),
  217. 'title' => array(
  218. 'type' => 'varchar',
  219. 'length' => 255,
  220. 'not null' => TRUE,
  221. 'default' => '',
  222. 'description' => 'Title of the feed item.',
  223. ),
  224. 'link' => array(
  225. 'type' => 'text',
  226. 'not null' => TRUE,
  227. 'description' => 'Link to the feed item.',
  228. ),
  229. 'author' => array(
  230. 'type' => 'varchar',
  231. 'length' => 255,
  232. 'not null' => TRUE,
  233. 'default' => '',
  234. 'description' => 'Author of the feed item.',
  235. ),
  236. 'description' => array(
  237. 'type' => 'text',
  238. 'not null' => TRUE,
  239. 'size' => 'big',
  240. 'description' => 'Body of the feed item.',
  241. ),
  242. 'timestamp' => array(
  243. 'type' => 'int',
  244. 'not null' => FALSE,
  245. 'description' => 'Posted date of the feed item, as a Unix timestamp.',
  246. ),
  247. 'guid' => array(
  248. 'type' => 'text',
  249. 'not null' => TRUE,
  250. 'description' => 'Unique identifier for the feed item.',
  251. )
  252. ),
  253. 'primary key' => array('iid'),
  254. 'indexes' => array(
  255. 'fid' => array('fid'),
  256. 'timestamp' => array('timestamp'),
  257. ),
  258. 'foreign keys' => array(
  259. 'aggregator_feed' => array(
  260. 'table' => 'aggregator_feed',
  261. 'columns' => array('fid' => 'fid'),
  262. ),
  263. ),
  264. );
  265. return $schema;
  266. }
  267. /**
  268. * @addtogroup updates-6.x-to-7.x
  269. * @{
  270. */
  271. /**
  272. * Add hash column to aggregator_feed table.
  273. */
  274. function aggregator_update_7000() {
  275. db_add_field('aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
  276. }
  277. /**
  278. * Add aggregator teaser length to settings from old global default teaser length
  279. */
  280. function aggregator_update_7001() {
  281. variable_set('aggregator_teaser_length', variable_get('teaser_length'));
  282. }
  283. /**
  284. * Add queued timestamp.
  285. */
  286. function aggregator_update_7002() {
  287. db_add_field('aggregator_feed', 'queued', array(
  288. 'type' => 'int',
  289. 'not null' => TRUE,
  290. 'default' => 0,
  291. 'description' => 'Time when this feed was queued for refresh, 0 if not queued.',
  292. ));
  293. db_add_index('aggregator_feed', 'queued', array('queued'));
  294. }
  295. /**
  296. * @} End of "addtogroup updates-6.x-to-7.x"
  297. */
  298. /**
  299. * @addtogroup updates-7.x-extra
  300. * @{
  301. */
  302. /**
  303. * Increase the length of {aggregator_feed}.url.
  304. */
  305. function aggregator_update_7003() {
  306. db_drop_unique_key('aggregator_feed', 'url');
  307. db_change_field('aggregator_feed', 'url', 'url', array('type' => 'text', 'not null' => TRUE, 'description' => 'URL to the feed.'));
  308. db_change_field('aggregator_feed', 'link', 'link', array('type' => 'text', 'not null' => TRUE, 'description' => 'The parent website of the feed; comes from the <link> element in the feed.'));
  309. db_change_field('aggregator_item', 'link', 'link', array('type' => 'text', 'not null' => TRUE, 'description' => 'Link to the feed item.'));
  310. db_change_field('aggregator_item', 'guid', 'guid', array('type' => 'text', 'not null' => TRUE, 'description' => 'Unique identifier for the feed item.'));
  311. db_add_index('aggregator_feed', 'url', array(array('url', 255)));
  312. }
  313. /**
  314. * Add index on timestamp.
  315. */
  316. function aggregator_update_7004() {
  317. if (!db_index_exists('aggregator_item', 'timestamp')) {
  318. db_add_index('aggregator_item', 'timestamp', array('timestamp'));
  319. }
  320. }
  321. /**
  322. * @} End of "addtogroup updates-7.x-extra"
  323. */

Functions

Namesort descending Description
aggregator_schema Implements hook_schema().
aggregator_uninstall Implements hook_uninstall().
aggregator_update_7000 Add hash column to aggregator_feed table.
aggregator_update_7001 Add aggregator teaser length to settings from old global default teaser length
aggregator_update_7002 Add queued timestamp.
aggregator_update_7003 Increase the length of {aggregator_feed}.url.
aggregator_update_7004 Add index on timestamp.