aggregator.install 7.81 KB
Newer Older
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Install, update and uninstall functions for the aggregator module.
 */

8
/**
9
 * Implements hook_uninstall().
10 11 12 13 14 15
 */
function aggregator_uninstall() {
  variable_del('aggregator_allowed_html_tags');
  variable_del('aggregator_summary_items');
  variable_del('aggregator_clear');
  variable_del('aggregator_category_selector');
16 17 18
  variable_del('aggregator_fetcher');
  variable_del('aggregator_parser');
  variable_del('aggregator_processors');
19
  variable_del('aggregator_teaser_length');
20
}
21 22

/**
23
 * Implements hook_schema().
24 25 26
 */
function aggregator_schema() {
  $schema['aggregator_category'] = array(
27
    'description' => 'Stores categories for aggregator feeds and feed items.',
28
    'fields' => array(
29 30 31
      'cid'  => array(
        'type' => 'serial',
        'not null' => TRUE,
32
        'description' => 'Primary Key: Unique aggregator category ID.',
33 34 35 36 37 38
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
39
        'description' => 'Title of the category.',
40 41 42 43 44
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
45
        'description' => 'Description of the category',
46 47 48 49 50 51
      ),
      'block' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
52
        'description' => 'The number of recent items to show within the category block.',
53
      )
54 55
    ),
    'primary key' => array('cid'),
56 57 58
    'unique keys' => array(
      'title' => array('title'),
    ),
59 60 61
  );

  $schema['aggregator_category_feed'] = array(
62
    'description' => 'Bridge table; maps feeds to categories.',
63
    'fields' => array(
64 65 66 67
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
68
        'description' => "The feed's {aggregator_feed}.fid.",
69 70 71 72 73
      ),
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
74
        'description' => 'The {aggregator_category}.cid to which the feed is being assigned.',
75
      )
76
    ),
77
    'primary key' => array('cid', 'fid'),
78 79 80
    'indexes' => array(
      'fid' => array('fid'),
    ),
81
    'foreign keys' => array(
82 83 84 85
      'aggregator_category' => array(
        'table' => 'aggregator_category',
        'columns' => array('cid' => 'cid'),
      ),
86
    ),
87 88 89
  );

  $schema['aggregator_category_item'] = array(
90
    'description' => 'Bridge table; maps feed items to categories.',
91
    'fields' => array(
92 93 94 95
      'iid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
96
        'description' => "The feed item's {aggregator_item}.iid.",
97 98 99 100 101
      ),
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
102
        'description' => 'The {aggregator_category}.cid to which the feed item is being assigned.',
103
      )
104
    ),
105
    'primary key' => array('cid', 'iid'),
106 107 108
    'indexes' => array(
      'iid' => array('iid'),
    ),
109
    'foreign keys' => array(
110 111 112 113
      'aggregator_category' => array(
        'table' => 'aggregator_category',
        'columns' => array('cid' => 'cid'),
      ),
114
    ),
115 116 117
  );

  $schema['aggregator_feed'] = array(
118
    'description' => 'Stores feeds to be parsed by the aggregator.',
119
    'fields' => array(
120 121 122
      'fid' => array(
        'type' => 'serial',
        'not null' => TRUE,
123
        'description' => 'Primary Key: Unique feed ID.',
124 125 126 127 128 129
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
130
        'description' => 'Title of the feed.',
131 132 133 134 135 136
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
137
        'description' => 'URL to the feed.',
138 139 140 141 142
      ),
      'refresh' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
143
        'description' => 'How often to check for new feed items, in seconds.',
144 145 146 147 148
      ),
      'checked' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
149
        'description' => 'Last time feed was checked for new items, as Unix timestamp.',
150
      ),
151 152 153 154 155 156
      'queued' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Time when this feed was queued for refresh, 0 if not queued.',
      ),
157 158 159 160 161
      'link' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
162
        'description' => 'The parent website of the feed; comes from the <link> element in the feed.',
163 164 165 166 167
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
168
        'description' => "The parent website's description; comes from the <description> element in the feed.",
169 170 171 172 173
      ),
      'image' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
174
        'description' => 'An image representing the feed.',
175
      ),
176 177
      'hash' => array(
        'type' => 'varchar',
178
        'length' => 64,
179 180
        'not null' => TRUE,
        'default' => '',
181
        'description' => 'Calculated hash of the feed data, used for validating cache.',
182
      ),
183 184 185 186 187
      'etag' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
188
        'description' => 'Entity tag HTTP response header, used for validating cache.',
189 190 191 192 193
      ),
      'modified' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
194
        'description' => 'When the feed was last modified, as a Unix timestamp.',
195 196 197 198 199 200
      ),
      'block' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
201
        'description' => "Number of items to display in the feed's block.",
202
      )
203
    ),
204
    'primary key' => array('fid'),
205 206
    'unique keys' => array(
      'url'  => array('url'),
207
      'title' => array('title'),
208
    ),
209 210 211
    'indexes' => array(
      'queued' => array('queued'),
    ),
212 213 214
  );

  $schema['aggregator_item'] = array(
215
    'description' => 'Stores the individual items imported from feeds.',
216
    'fields' => array(
217 218 219
      'iid'  => array(
        'type' => 'serial',
        'not null' => TRUE,
220
        'description' => 'Primary Key: Unique ID for feed item.',
221 222 223 224 225
      ),
      'fid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
226
        'description' => 'The {aggregator_feed}.fid to which this item belongs.',
227 228
      ),
      'title' => array(
Dries's avatar
Dries committed
229 230
        'type' => 'varchar',
        'length' => 255,
231
        'not null' => TRUE,
Dries's avatar
Dries committed
232
        'default' => '',
233
        'description' => 'Title of the feed item.',
234 235 236 237 238 239
      ),
      'link' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
240
        'description' => 'Link to the feed item.',
241 242 243 244 245 246
      ),
      'author' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
247
        'description' => 'Author of the feed item.',
248 249 250 251 252
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
253
        'description' => 'Body of the feed item.',
254 255 256 257
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => FALSE,
258
        'description' => 'Posted date of the feed item, as a Unix timestamp.',
259 260 261 262 263
      ),
      'guid' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
264
        'description' => 'Unique identifier for the feed item.',
265
      )
266 267
    ),
    'primary key' => array('iid'),
268 269 270
    'indexes' => array(
      'fid' => array('fid'),
    ),
271
    'foreign keys' => array(
272 273 274 275
      'aggregator_feed' => array(
        'table' => 'aggregator_feed',
        'columns' => array('fid' => 'fid'),
      ),
276
    ),
277 278 279 280
  );

  return $schema;
}