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