Projet

Général

Profil

Paste
Télécharger (22,4 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds / feeds.install @ ec2b0e7b

1
<?php
2

    
3
/**
4
 * @file
5
 * Schema definitions install/update/uninstall hooks.
6
 */
7

    
8
/**
9
 * Implements hook_requirements().
10
 */
11
function feeds_requirements($phase) {
12
  $t = get_t();
13

    
14
  $requirements = array();
15

    
16
  module_load_include('module', 'feeds');
17
  // Check if we have any SimplePie importers.
18
  $needs_simplepie = FALSE;
19
  foreach (feeds_importer_load_all() as $importer) {
20
    if ($importer->config['parser']['plugin_key'] === 'FeedsSimplePieParser') {
21
      $needs_simplepie = TRUE;
22
      break;
23
    }
24
  }
25

    
26
  if (!$needs_simplepie) {
27
    return $requirements;
28
  }
29

    
30
  $requirements['simplepie'] = array(
31
    'title' => $t('SimplePie'),
32
    'value' => $t('Installed'),
33
    'description' => $t('The SimplePie library is required for Feeds SimplePie Parser.'),
34
    'severity' => REQUIREMENT_OK,
35
  );
36

    
37
  if (!feeds_simplepie_exists()) {
38
    $requirements['simplepie']['value'] = $t('Not installed');
39

    
40
    $folder = drupal_get_path('module', 'feeds') . '/libraries';
41
    if (module_exists('libraries')) {
42
      $folder = 'sites/all/libraries/simplepie';
43
    }
44

    
45
    $args = array(
46
      '!url' => 'http://simplepie.org/downloads/',
47
      '%folder' => $folder,
48
      '%file' => 'simplepie.compiled.php',
49
    );
50
    $requirements['simplepie']['description'] .= $t('<br />Download the compiled, single-file version of the library from the <a href="!url">SimplePie download page</a>, place it into %folder and rename it to %file.', $args);
51
    $requirements['simplepie']['severity'] = REQUIREMENT_ERROR;
52
  }
53

    
54
  return $requirements;
55
}
56

    
57
/**
58
 * Implements hook_install().
59
 */
60
function feeds_install() {
61
  // Activate our custom cache handler for the HTTP cache.
62
  variable_set('cache_class_cache_feeds_http', 'FeedsHTTPCache');
63
}
64

    
65
/**
66
 * Implements hook_uninstall().
67
 */
68
function feeds_uninstall() {
69
  variable_del('cache_class_cache_feeds_http');
70
  variable_del('cache_flush_cache_feeds_http');
71
  variable_del('default_feeds_importer');
72
  variable_del('feeds_debug');
73
  variable_del('feeds_http_file_cache_dir');
74
  variable_del('feeds_importer_class');
75
  variable_del('feeds_in_progress_dir');
76
  variable_del('feeds_library_dir');
77
  variable_del('feeds_never_use_curl');
78
  variable_del('feeds_process_limit');
79
  variable_del('feeds_reschedule');
80
  variable_del('feeds_source_class');
81
  variable_del('feeds_sync_cache_feeds_http_interval');
82
  variable_del('feeds_sync_cache_feeds_http_last_check');
83
  variable_del('feeds_use_mbstring');
84
  variable_del('http_request_timeout');
85

    
86
  // Remove Feeds related jobs from job scheduler.
87
  $names = db_or()
88
    ->condition('name', 'feeds_source_import')
89
    ->condition('name', 'feeds_source_clear')
90
    ->condition('name', 'feeds_source_expire')
91
    ->condition('name', 'feeds_push_unsubscribe');
92

    
93
  db_delete('job_schedule')
94
    ->condition($names)
95
    ->execute();
96
}
97

    
98
/**
99
 * Implements hook_schema().
100
 */
101
function feeds_schema() {
102
  $schema = array();
103

    
104
  $schema['feeds_importer'] = array(
105
    'description' => 'Configuration of feeds objects.',
106
    'export' => array(
107
      'key' => 'id',
108
      'identifier' => 'feeds_importer',
109
      'default hook' => 'feeds_importer_default',  // Function hook name.
110
      'api' => array(
111
        'owner' => 'feeds',
112
        'api' => 'feeds_importer_default',  // Base name for api include files.
113
        'minimum_version' => 1,
114
        'current_version' => 1,
115
      ),
116
    ),
117
    'fields' => array(
118
      'id' => array(
119
        'type' => 'varchar',
120
        'length' => 128,
121
        'not null' => TRUE,
122
        'default' => '',
123
        'description' => 'Id of the fields object.',
124
      ),
125
      'config' => array(
126
        'type' => 'blob',
127
        'size' => 'big',
128
        'not null' => FALSE,
129
        'description' => 'Configuration of the feeds object.',
130
        'serialize' => TRUE,
131
      ),
132
    ),
133
    'primary key' => array('id'),
134
  );
135
  $schema['feeds_source'] = array(
136
    'description' => 'Source definitions for feeds.',
137
    'fields' => array(
138
      'id' => array(
139
        'type' => 'varchar',
140
        'length' => 128,
141
        'not null' => TRUE,
142
        'default' => '',
143
        'description' => 'Id of the feed configuration.',
144
      ),
145
      'feed_nid' => array(
146
        'type' => 'int',
147
        'not null' => TRUE,
148
        'default' => 0,
149
        'unsigned' => TRUE,
150
        'description' => 'Node nid if this particular source is attached to a feed node.',
151
      ),
152
      'config' => array(
153
        'type' => 'blob',
154
        'size' => 'big',
155
        'not null' => FALSE,
156
        'description' => 'Configuration of the source.',
157
        'serialize' => TRUE,
158
      ),
159
      'source' => array(
160
        'type' => 'text',
161
        'not null' => TRUE,
162
        'description' => 'Main source resource identifier. E. g. a path or a URL.',
163
      ),
164
      'state' => array(
165
        'type' => 'blob',
166
        'size' => 'big',
167
        'not null' => FALSE,
168
        'description' => 'State of import or clearing batches.',
169
        'serialize' => TRUE,
170
      ),
171
      'fetcher_result' => array(
172
        'type' => 'blob',
173
        'size' => 'big',
174
        'not null' => FALSE,
175
        'description' => 'Cache for fetcher result.',
176
        'serialize' => TRUE,
177
      ),
178
      'imported' => array(
179
        'type' => 'int',
180
        'not null' => TRUE,
181
        'default' => 0,
182
        'unsigned' => TRUE,
183
        'description' => 'Timestamp when this source was imported last.',
184
      ),
185
    ),
186
    'primary key' => array('id', 'feed_nid'),
187
    'indexes' => array(
188
      'id' => array('id'),
189
      'feed_nid' => array('feed_nid'),
190
      'id_source' => array('id', array('source', 128)),
191
    ),
192
  );
193
  $schema['feeds_item'] = array(
194
    'description' => 'Tracks items such as nodes, terms, users.',
195
    'fields' => array(
196
      'entity_type' => array(
197
        'type' => 'varchar',
198
        'length' => 32,
199
        'not null' => TRUE,
200
        'default' => '',
201
        'description' => 'The entity type.',
202
      ),
203
      'entity_id' => array(
204
        'type' => 'int',
205
        'unsigned' => TRUE,
206
        'not null' => TRUE,
207
        'description' => 'The imported entity\'s serial id.',
208
      ),
209
      'id' => array(
210
        'type' => 'varchar',
211
        'length' => 128,
212
        'not null' => TRUE,
213
        'default' => '',
214
        'description' => 'The id of the importer that created this item.',
215
      ),
216
      'feed_nid' => array(
217
        'type' => 'int',
218
        'unsigned' => TRUE,
219
        'not null' => TRUE,
220
        'description' => 'Node id of the source, if available.',
221
      ),
222
      'imported' => array(
223
        'type' => 'int',
224
        'not null' => TRUE,
225
        'default' => 0,
226
        'description' => 'Import date of the feed item, as a Unix timestamp.',
227
      ),
228
      'url' => array(
229
        'type' => 'text',
230
        'not null' => TRUE,
231
        'description' => 'Link to the feed item.',
232
      ),
233
      'guid' => array(
234
        'type' => 'text',
235
        'not null' => TRUE,
236
        'description' => 'Unique identifier for the feed item.'
237
      ),
238
      'hash' => array(
239
        'type' => 'varchar',
240
        'length' => 32, // The length of an MD5 hash.
241
        'not null' => TRUE,
242
        'default' => '',
243
        'description' => 'The hash of the source item.',
244
      ),
245
    ),
246
    'primary key' => array('entity_type', 'entity_id'),
247
    'indexes' => array(
248
      'id' => array('id'),
249
      'feed_nid' => array('feed_nid'),
250
      'lookup_url' => array('entity_type', 'id', 'feed_nid', array('url', 128)),
251
      'lookup_guid' => array('entity_type', 'id', 'feed_nid', array('guid', 128)),
252
      'global_lookup_url' => array('entity_type', array('url', 128)),
253
      'global_lookup_guid' => array('entity_type', array('guid', 128)),
254
      'imported' => array('imported'),
255
    ),
256
  );
257
  $schema['feeds_push_subscriptions'] = array(
258
    'description' => 'PubSubHubbub subscriptions.',
259
    'fields' => array(
260
      'domain' => array(
261
        'type' => 'varchar',
262
        'length' => 128,
263
        'not null' => TRUE,
264
        'default' => '',
265
        'description' => 'Domain of the subscriber. Corresponds to an importer id.',
266
      ),
267
      'subscriber_id' => array(
268
        'type' => 'int',
269
        'not null' => TRUE,
270
        'default' => 0,
271
        'unsigned' => TRUE,
272
        'description' => 'ID of the subscriber. Corresponds to a feed nid.',
273
      ),
274
      'timestamp' => array(
275
        'type' => 'int',
276
        'unsigned' => FALSE,
277
        'default' => 0,
278
        'not null' => TRUE,
279
        'description' => 'Created timestamp.',
280
      ),
281
      'hub' => array(
282
        'type' => 'text',
283
        'not null' => TRUE,
284
        'description' => 'The URL of the hub endpoint of this subscription.',
285
      ),
286
      'topic' => array(
287
        'type' => 'text',
288
        'not null' => TRUE,
289
        'description' => 'The topic URL (feed URL) of this subscription.',
290
      ),
291
      'secret' => array(
292
        'type' => 'varchar',
293
        'length' => 128,
294
        'not null' => TRUE,
295
        'default' => '',
296
        'description' => 'Shared secret for message authentication.',
297
      ),
298
      'status' => array(
299
        'type' => 'varchar',
300
        'length' => 64,
301
        'not null' => TRUE,
302
        'default' => '',
303
        'description' => 'Status of subscription.',
304
      ),
305
      'post_fields' => array(
306
        'type' => 'text',
307
        'not null' => FALSE,
308
        'description' => 'Fields posted.',
309
        'serialize' => TRUE,
310
      ),
311
    ),
312
    'primary key' => array('domain', 'subscriber_id'),
313
    'indexes' => array(
314
      'timestamp' => array('timestamp'),
315
    ),
316
  );
317
  $schema['feeds_log'] = array(
318
    'description' => 'Table that contains logs of feeds events.',
319
    'fields' => array(
320
      'flid' => array(
321
        'type' => 'serial',
322
        'not null' => TRUE,
323
        'description' => 'Primary Key: Unique feeds event ID.',
324
      ),
325
      'id' => array(
326
        'type' => 'varchar',
327
        'length' => 128,
328
        'not null' => TRUE,
329
        'default' => '',
330
        'description' => 'The id of the importer that logged the event.',
331
      ),
332
      'feed_nid' => array(
333
        'type' => 'int',
334
        'unsigned' => TRUE,
335
        'not null' => TRUE,
336
        'description' => 'Node id of the source, if available.',
337
      ),
338
      'log_time' => array(
339
        'type' => 'int',
340
        'not null' => TRUE,
341
        'default' => 0,
342
        'description' => 'Unix timestamp of when event occurred.',
343
      ),
344
      'request_time' => array(
345
        'type' => 'int',
346
        'not null' => TRUE,
347
        'default' => 0,
348
        'description' => 'Unix timestamp of the request when the event occurred.',
349
      ),
350
      'type' => array(
351
        'type' => 'varchar',
352
        'length' => 64,
353
        'not null' => TRUE,
354
        'default' => '',
355
        'description' => 'Type of log message, for example "feeds_import"."',
356
      ),
357
      'message' => array(
358
        'type' => 'text',
359
        'not null' => TRUE,
360
        'size' => 'big',
361
        'description' => 'Text of log message to be passed into the t() function.',
362
      ),
363
      'variables' => array(
364
        'type' => 'blob',
365
        'not null' => TRUE,
366
        'size' => 'big',
367
        'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
368
      ),
369
      'severity' => array(
370
        'type' => 'int',
371
        'unsigned' => TRUE,
372
        'not null' => TRUE,
373
        'default' => 0,
374
        'size' => 'tiny',
375
        'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
376
      ),
377
    ),
378
    'primary key' => array('flid'),
379
    'indexes' => array(
380
      'id' => array('id'),
381
      'id_feed_nid' => array('id', 'feed_nid'),
382
      'request_time' => array('request_time'),
383
      'log_time' => array('log_time'),
384
      'type' => array('type'),
385
    ),
386
  );
387

    
388
  $schema['cache_feeds_http'] = drupal_get_schema_unprocessed('system', 'cache');
389
  $schema['cache_feeds_http']['description'] = 'Cache table for Feeds downloads.';
390

    
391
  return $schema;
392
}
393

    
394
/**
395
 * Rename feeds_source.batch to feeds_source.state, add slot for caching fetcher
396
 * result.
397
 */
398
function feeds_update_7100() {
399
  $spec = array(
400
    'type' => 'text',
401
    'size' => 'big',
402
    'not null' => FALSE,
403
    'description' => 'State of import or clearing batches.',
404
    'serialize' => TRUE,
405
  );
406
  db_change_field('feeds_source', 'batch', 'state', $spec);
407

    
408
  $spec = array(
409
    'type' => 'text',
410
    'size' => 'big',
411
    'not null' => FALSE,
412
    'description' => 'Cache for fetcher result.',
413
    'serialize' => TRUE,
414
  );
415
  db_add_field('feeds_source', 'fetcher_result', $spec);
416
}
417

    
418
/**
419
 * Add imported timestamp to feeds_source table.
420
 */
421
function feeds_update_7201() {
422
  $spec = array(
423
    'type' => 'int',
424
    'not null' => TRUE,
425
    'default' => 0,
426
    'unsigned' => TRUE,
427
    'description' => 'Timestamp when this source was imported last.',
428
  );
429
  db_add_field('feeds_source', 'imported', $spec);
430
}
431

    
432
/**
433
 * Create a single feeds_item table tracking all imports.
434
 */
435
function feeds_update_7202() {
436
  $spec = array(
437
    'description' => 'Tracks items such as nodes, terms, users.',
438
    'fields' => array(
439
      'entity_type' => array(
440
        'type' => 'varchar',
441
        'length' => 32,
442
        'not null' => TRUE,
443
        'default' => '',
444
        'description' => 'The entity type.',
445
      ),
446
      'entity_id' => array(
447
        'type' => 'int',
448
        'unsigned' => TRUE,
449
        'not null' => TRUE,
450
        'description' => 'The imported entity\'s serial id.',
451
      ),
452
      'id' => array(
453
        'type' => 'varchar',
454
        'length' => 128,
455
        'not null' => TRUE,
456
        'default' => '',
457
        'description' => 'The id of the importer that created this item.',
458
      ),
459
      'feed_nid' => array(
460
        'type' => 'int',
461
        'unsigned' => TRUE,
462
        'not null' => TRUE,
463
        'description' => 'Node id of the source, if available.',
464
      ),
465
      'imported' => array(
466
        'type' => 'int',
467
        'not null' => TRUE,
468
        'default' => 0,
469
        'description' => 'Import date of the feed item, as a Unix timestamp.',
470
      ),
471
      'url' => array(
472
        'type' => 'text',
473
        'not null' => TRUE,
474
        'description' => 'Link to the feed item.',
475
      ),
476
      'guid' => array(
477
        'type' => 'text',
478
        'not null' => TRUE,
479
        'description' => 'Unique identifier for the feed item.'
480
      ),
481
      'hash' => array(
482
        'type' => 'varchar',
483
        'length' => 32, // The length of an MD5 hash.
484
        'not null' => TRUE,
485
        'default' => '',
486
        'description' => 'The hash of the source item.',
487
      ),
488
    ),
489
    'primary key' => array('entity_type', 'entity_id'),
490
    'indexes' => array(
491
      'id' => array('id'),
492
      'feed_nid' => array('feed_nid'),
493
      'lookup_url' => array('entity_type', 'id', 'feed_nid', array('url', 128)),
494
      'lookup_guid' => array('entity_type', 'id', 'feed_nid', array('guid', 128)),
495
      'imported' => array('imported'),
496
    ),
497
  );
498
  db_create_table('feeds_item', $spec);
499
  // Copy all existing values from old tables and drop them.
500
  $insert = "INSERT INTO {feeds_item} (entity_type, entity_id, id, feed_nid, imported, url, guid, hash)";
501
  db_query($insert . " SELECT 'node', nid, id, feed_nid, imported, url, guid, hash FROM {feeds_node_item}");
502
  db_query($insert . " SELECT 'taxonomy_term', tid, id, feed_nid, 0, '', '', '' FROM {feeds_term_item}");
503
  db_drop_table('feeds_node_item');
504
  db_drop_table('feeds_term_item');
505
}
506

    
507
/**
508
 * Add feeds_log table.
509
 */
510
function feeds_update_7203() {
511
  $schema = array(
512
    'description' => 'Table that contains logs of feeds events.',
513
    'fields' => array(
514
      'flid' => array(
515
        'type' => 'serial',
516
        'not null' => TRUE,
517
        'description' => 'Primary Key: Unique feeds event ID.',
518
      ),
519
      'id' => array(
520
        'type' => 'varchar',
521
        'length' => 128,
522
        'not null' => TRUE,
523
        'default' => '',
524
        'description' => 'The id of the importer that logged the event.',
525
      ),
526
      'feed_nid' => array(
527
        'type' => 'int',
528
        'unsigned' => TRUE,
529
        'not null' => TRUE,
530
        'description' => 'Node id of the source, if available.',
531
      ),
532
      'log_time' => array(
533
        'type' => 'int',
534
        'not null' => TRUE,
535
        'default' => 0,
536
        'description' => 'Unix timestamp of when event occurred.',
537
      ),
538
      'request_time' => array(
539
        'type' => 'int',
540
        'not null' => TRUE,
541
        'default' => 0,
542
        'description' => 'Unix timestamp of the request when the event occurred.',
543
      ),
544
      'type' => array(
545
        'type' => 'varchar',
546
        'length' => 64,
547
        'not null' => TRUE,
548
        'default' => '',
549
        'description' => 'Type of log message, for example "feeds_import"."',
550
      ),
551
      'message' => array(
552
        'type' => 'text',
553
        'not null' => TRUE,
554
        'size' => 'big',
555
        'description' => 'Text of log message to be passed into the t() function.',
556
      ),
557
      'variables' => array(
558
        'type' => 'blob',
559
        'not null' => TRUE,
560
        'size' => 'big',
561
        'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
562
      ),
563
      'severity' => array(
564
        'type' => 'int',
565
        'unsigned' => TRUE,
566
        'not null' => TRUE,
567
        'default' => 0,
568
        'size' => 'tiny',
569
        'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
570
      ),
571
    ),
572
    'primary key' => array('flid'),
573
    'indexes' => array(
574
      'id' => array('id'),
575
      'id_feed_nid' => array('id', 'feed_nid'),
576
      'request_time' => array('request_time'),
577
      'log_time' => array('log_time'),
578
      'type' => array('type'),
579
    ),
580
  );
581
  db_create_table('feeds_log', $schema);
582
}
583

    
584
/**
585
 * Add index for looking up by entity_type + url/ guid to feeds_item table.
586
 */
587
function feeds_update_7204() {
588
  db_add_index('feeds_item', 'global_lookup_url', array('entity_type', array('url', 128)));
589
  db_add_index('feeds_item', 'global_lookup_guid', array('entity_type', array('guid', 128)));
590
}
591

    
592
/**
593
 * Shorten {feeds_item}.entity_type to 32 chars and shorten relevant indexes.
594
 */
595
function feeds_update_7205() {
596
  db_drop_primary_key('feeds_item');
597
  db_drop_index('feeds_item', 'lookup_url');
598
  db_drop_index('feeds_item', 'lookup_guid');
599
  db_drop_index('feeds_item', 'global_lookup_url');
600
  db_drop_index('feeds_item', 'global_lookup_guid');
601

    
602
  db_change_field('feeds_item', 'entity_type', 'entity_type', array(
603
    'type' => 'varchar',
604
    'length' => 32,
605
    'not null' => TRUE,
606
    'default' => '',
607
    'description' => 'The entity type.',
608
  ));
609

    
610
  db_add_primary_key('feeds_item', array('entity_type', 'entity_id'));
611
  db_add_index('feeds_item', 'lookup_url', array('entity_type', 'id', 'feed_nid', array('url', 128)));
612
  db_add_index('feeds_item', 'lookup_guid', array('entity_type', 'id', 'feed_nid', array('guid', 128)));
613
  db_add_index('feeds_item', 'global_lookup_url', array('entity_type', array('url', 128)));
614
  db_add_index('feeds_item', 'global_lookup_guid', array('entity_type', array('guid', 128)));
615
}
616

    
617
/**
618
 * Change state and fetcher_result fields from text to blob.
619
 */
620
function feeds_update_7206() {
621
  db_change_field('feeds_source', 'state', 'state', array(
622
    'type' => 'blob',
623
    'size' => 'big',
624
    'not null' => FALSE,
625
    'description' => 'State of import or clearing batches.',
626
    'serialize' => TRUE,
627
  ));
628

    
629
  db_change_field('feeds_source', 'fetcher_result', 'fetcher_result', array(
630
    'type' => 'blob',
631
    'size' => 'big',
632
    'not null' => FALSE,
633
    'description' => 'Cache for fetcher result.',
634
    'serialize' => TRUE,
635
  ));
636
}
637

    
638
/**
639
 * Change config fields from text to big blobs.
640
 */
641
function feeds_update_7207() {
642
  db_change_field('feeds_importer', 'config', 'config', array(
643
    'type' => 'blob',
644
    'size' => 'big',
645
    'not null' => FALSE,
646
    'description' => 'Configuration of the feeds object.',
647
    'serialize' => TRUE,
648
  ));
649

    
650
  db_change_field('feeds_source', 'config', 'config', array(
651
    'type' => 'blob',
652
    'size' => 'big',
653
    'not null' => FALSE,
654
    'description' => 'Configuration of the feeds object.',
655
    'serialize' => TRUE,
656
  ));
657
}
658

    
659
/**
660
 * Update to use generic bundle handling.
661
 */
662
function feeds_update_7208(&$sandbox) {
663

    
664
  if (!isset($sandbox['importers'])) {
665
    // Get all importers.
666
    $sandbox['importers'] = db_query("SELECT id FROM {feeds_importer}")->fetchCol();
667
    $sandbox['total'] = count($sandbox['importers']);
668
  }
669

    
670
  $importer = array_pop($sandbox['importers']);
671
  $config = db_query("SELECT config FROM {feeds_importer} WHERE id = :id", array(':id' => $importer))->fetchField();
672

    
673
  if ($config) {
674
    $config = unserialize($config);
675

    
676
    switch ($config['processor']['plugin_key']) {
677
      case 'FeedsNodeProcessor':
678
        $config_key = 'content_type';
679
        break;
680

    
681
      case 'FeedsTermProcessor':
682
        $config_key = 'vocabulary';
683
        break;
684

    
685
      default:
686
        $config_key = FALSE;
687
        break;
688
    }
689

    
690
    if ($config_key && isset($config['processor']['config'][$config_key])) {
691
      $config['processor']['config']['bundle'] = $config['processor']['config'][$config_key];
692
      unset($config['processor']['config'][$config_key]);
693

    
694
      // Update databse.
695
      db_update('feeds_importer')
696
        ->fields(array(
697
          'config' => serialize($config),
698
        ))
699
        ->condition('id', $importer)
700
        ->execute();
701
    }
702

    
703
    $sandbox['#finished'] = 1 - count($sandbox['importers']) / $sandbox['total'];
704
  }
705
  else {
706
    $sandbox['#finished'] = 1;
707
  }
708
}
709

    
710
/**
711
 * Reschedules feeds jobs.
712
 */
713
function feeds_update_7209() {
714
  // Reschedule all importers.
715
  variable_set('feeds_reschedule', TRUE);
716

    
717
  // Our expire callback has changed names, remove all existing callbacks.
718
  db_delete('job_schedule')
719
    ->condition('name', 'feeds_importer_expire')
720
    ->execute();
721

    
722
  DrupalQueue::get('feeds_importer_expire')->deleteQueue();
723
}
724

    
725
 /**
726
  * Does nothing. Update removed.
727
  */
728
function feeds_update_7211(&$sandbox) {
729
}
730

    
731
/**
732
 * Create {cache_feeds_http} table.
733
 */
734
function feeds_update_7212() {
735
  if (!db_table_exists('cache_feeds_http')) {
736
    $schema = drupal_get_schema_unprocessed('system', 'cache');
737
    $schema['description'] = 'Cache table for Feeds downloads.';
738
    db_create_table('cache_feeds_http', $schema);
739
  }
740
}
741

    
742
/**
743
 * Set cache class for Feeds HTTP cache.
744
 */
745
function feeds_update_7213() {
746
  // Perform a registry rebuild so the system hopefully discovers the
747
  // FeedsHTTPCache class.
748
  if (function_exists('registry_rebuild')) {
749
    registry_rebuild();
750
  }
751

    
752
  // Abort when the FeedsHTTPCache class is not yet found to avoid fatal errors
753
  // in _cache_get_object().
754
  if (!class_exists('FeedsHTTPCache')) {
755
    throw new DrupalUpdateException('Setting the cache class for the cache_feeds_http bin failed because the FeedsHTTPCache class could not be found. Please rebuild the Drupal class registry and perform database updates again.');
756
  }
757

    
758
  // Activate our custom cache handler for the HTTP cache.
759
  variable_set('cache_class_cache_feeds_http', 'FeedsHTTPCache');
760
}