Code coverage for /20081101/modules/aggregator/aggregator.install

Line #Times calledCode
1
<?php
2
// $Id: aggregator.install,v 1.17 2008/08/12 07:00:48 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
712
function aggregator_install() {
8
  // Create tables.
98
  drupal_install_schema('aggregator');
108
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
1512
function aggregator_uninstall() {
16
  // Remove tables.
171
  drupal_uninstall_schema('aggregator');
18
191
  variable_del('aggregator_allowed_html_tags');
201
  variable_del('aggregator_summary_items');
211
  variable_del('aggregator_clear');
221
  variable_del('aggregator_category_selector');
231
}
24
25
/**
26
 * Implementation of hook_schema().
27
 */
2812
function aggregator_schema() {
299
  $schema['aggregator_category'] = array(
309
    'description' => t('Stores categories for aggregator feeds and feed
items.'),
31
    'fields' => array(
32
      'cid'  => array(
339
        'type' => 'serial',
349
        'not null' => TRUE,
359
        'description' => t('Primary Key: Unique aggregator category ID.'),
369
      ),
37
      'title' => array(
389
        'type' => 'varchar',
399
        'length' => 255,
409
        'not null' => TRUE,
419
        'default' => '',
429
        'description' => t('Title of the category.'),
439
      ),
44
      'description' => array(
459
        'type' => 'text',
469
        'not null' => TRUE,
479
        'size' => 'big',
489
        'description' => t('Description of the category'),
499
      ),
50
      'block' => array(
519
        'type' => 'int',
529
        'not null' => TRUE,
539
        'default' => 0,
549
        'size' => 'tiny',
559
        'description' => t('The number of recent items to show within the
category block.'),
56
      )
579
    ),
589
    'primary key' => array('cid'),
59
    'unique keys' => array(
609
      'title' => array('title'),
619
    ),
62
  );
63
649
  $schema['aggregator_category_feed'] = array(
659
    'description' => t('Bridge table; maps feeds to categories.'),
66
    'fields' => array(
67
      'fid' => array(
689
        'type' => 'int',
699
        'not null' => TRUE,
709
        'default' => 0,
719
        'description' => t("The feed's {aggregator_feed}.fid."),
729
      ),
73
      'cid' => array(
749
        'type' => 'int',
759
        'not null' => TRUE,
769
        'default' => 0,
779
        'description' => t('The {aggregator_category}.cid to which the feed
is being assigned.'),
78
      )
799
    ),
809
    'primary key' => array('cid', 'fid'),
81
    'indexes' => array(
829
      'fid' => array('fid'),
839
    ),
84
  );
85
869
  $schema['aggregator_category_item'] = array(
879
    'description' => t('Bridge table; maps feed items to categories.'),
88
    'fields' => array(
89
      'iid' => array(
909
        'type' => 'int',
919
        'not null' => TRUE,
929
        'default' => 0,
939
        'description' => t("The feed item's {aggregator_item}.iid."),
949
      ),
95
      'cid' => array(
969
        'type' => 'int',
979
        'not null' => TRUE,
989
        'default' => 0,
999
        'description' => t('The {aggregator_category}.cid to which the feed
item is being assigned.'),
100
      )
1019
    ),
1029
    'primary key' => array('cid', 'iid'),
103
    'indexes' => array(
1049
      'iid' => array('iid'),
1059
    ),
106
  );
107
1089
  $schema['aggregator_feed'] = array(
1099
    'description' => t('Stores feeds to be parsed by the aggregator.'),
110
    'fields' => array(
111
      'fid' => array(
1129
        'type' => 'serial',
1139
        'not null' => TRUE,
1149
        'description' => t('Primary Key: Unique feed ID.'),
1159
      ),
116
      'title' => array(
1179
        'type' => 'varchar',
1189
        'length' => 255,
1199
        'not null' => TRUE,
1209
        'default' => '',
1219
        'description' => t('Title of the feed.'),
1229
      ),
123
      'url' => array(
1249
        'type' => 'varchar',
1259
        'length' => 255,
1269
        'not null' => TRUE,
1279
        'default' => '',
1289
        'description' => t('URL to the feed.'),
1299
      ),
130
      'refresh' => array(
1319
        'type' => 'int',
1329
        'not null' => TRUE,
1339
        'default' => 0,
1349
        'description' => t('How often to check for new feed items, in
seconds.'),
1359
      ),
136
      'checked' => array(
1379
        'type' => 'int',
1389
        'not null' => TRUE,
1399
        'default' => 0,
1409
        'description' => t('Last time feed was checked for new items, as
Unix timestamp.'),
1419
      ),
142
      'link' => array(
1439
        'type' => 'varchar',
1449
        'length' => 255,
1459
        'not null' => TRUE,
1469
        'default' => '',
1479
        'description' => t('The parent website of the feed; comes from the
<link> element in the feed.'),
1489
      ),
149
      'description' => array(
1509
        'type' => 'text',
1519
        'not null' => TRUE,
1529
        'size' => 'big',
1539
        'description' => t("The parent website's description; comes from
the <description> element in the feed."),
1549
      ),
155
      'image' => array(
1569
        'type' => 'text',
1579
        'not null' => TRUE,
1589
        'size' => 'big',
1599
        'description' => t('An image representing the feed.'),
1609
      ),
161
      'hash' => array(
1629
        'type' => 'varchar',
1639
        'length' => 32,
1649
        'not null' => TRUE,
1659
        'default' => '',
1669
        'description' => t('Calculated md5 hash of the feed data, used for
validating cache.'),
1679
      ),
168
      'etag' => array(
1699
        'type' => 'varchar',
1709
        'length' => 255,
1719
        'not null' => TRUE,
1729
        'default' => '',
1739
        'description' => t('Entity tag HTTP response header, used for
validating cache.'),
1749
      ),
175
      'modified' => array(
1769
        'type' => 'int',
1779
        'not null' => TRUE,
1789
        'default' => 0,
1799
        'description' => t('When the feed was last modified, as a Unix
timestamp.'),
1809
      ),
181
      'block' => array(
1829
        'type' => 'int',
1839
        'not null' => TRUE,
1849
        'default' => 0,
1859
        'size' => 'tiny',
1869
        'description' => t("Number of items to display in the feed's
block."),
187
      )
1889
    ),
1899
    'primary key' => array('fid'),
190
    'unique keys' => array(
1919
      'url'  => array('url'),
1929
      'title' => array('title'),
1939
    ),
194
  );
195
1969
  $schema['aggregator_item'] = array(
1979
    'description' => t('Stores the individual items imported from feeds.'),
198
    'fields' => array(
199
      'iid'  => array(
2009
        'type' => 'serial',
2019
        'not null' => TRUE,
2029
        'description' => t('Primary Key: Unique ID for feed item.'),
2039
      ),
204
      'fid' => array(
2059
        'type' => 'int',
2069
        'not null' => TRUE,
2079
        'default' => 0,
2089
        'description' => t('The {aggregator_feed}.fid to which this item
belongs.'),
2099
      ),
210
      'title' => array(
2119
        'type' => 'varchar',
2129
        'length' => 255,
2139
        'not null' => TRUE,
2149
        'default' => '',
2159
        'description' => t('Title of the feed item.'),
2169
      ),
217
      'link' => array(
2189
        'type' => 'varchar',
2199
        'length' => 255,
2209
        'not null' => TRUE,
2219
        'default' => '',
2229
        'description' => t('Link to the feed item.'),
2239
      ),
224
      'author' => array(
2259
        'type' => 'varchar',
2269
        'length' => 255,
2279
        'not null' => TRUE,
2289
        'default' => '',
2299
        'description' => t('Author of the feed item.'),
2309
      ),
231
      'description' => array(
2329
        'type' => 'text',
2339
        'not null' => TRUE,
2349
        'size' => 'big',
2359
        'description' => t('Body of the feed item.'),
2369
      ),
237
      'timestamp' => array(
2389
        'type' => 'int',
2399
        'not null' => FALSE,
2409
        'description' => t('Posted date of the feed item, as a Unix
timestamp.'),
2419
      ),
242
      'guid' => array(
2439
        'type' => 'varchar',
2449
        'length' => 255,
2459
        'not null' => FALSE,
2469
        'description' => t('Unique identifier for the feed item.'),
247
      )
2489
    ),
2499
    'primary key' => array('iid'),
250
    'indexes' => array(
2519
      'fid' => array('fid'),
2529
    ),
253
  );
254
2559
  return $schema;
2560
}
257
258
/**
259
 * Add hash column to aggregator_feed table.
260
 */
26112
function aggregator_update_7000() {
2620
  $ret = array();
2630
  db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar',
'length' => 32, 'not null' => TRUE, 'default' => ''));
2640
  return $ret;
2650
}
26612