aggregator.install 3.64 KB
Newer Older
1
<?php
2
// $Id$
3

4
5
6
/**
 * Implementation of hook_install().
 */
7
function aggregator_install() {
8
9
  // Create tables.
  drupal_install_schema('aggregator');
10
}
11
12
13
14
15

/**
 * Implementation of hook_uninstall().
 */
function aggregator_uninstall() {
16
17
18
  // Remove tables.
  drupal_uninstall_schema('aggregator');

19
20
21
22
23
  variable_del('aggregator_allowed_html_tags');
  variable_del('aggregator_summary_items');
  variable_del('aggregator_clear');
  variable_del('aggregator_category_selector');
}
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

/**
 * Implementation of hook_schema().
 */
function aggregator_schema() {
  $schema['aggregator_category'] = array(
    'fields' => array(
      'cid'         => array('type' => 'serial', 'not null' => TRUE),
      'title'       => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'description' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'block'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
    ),
    'primary key' => array('cid'),
    'unique keys' => array('title' => array('title')),
  );

  $schema['aggregator_category_feed'] = array(
    'fields' => array(
      'fid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'cid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('fid', 'cid'),
  );

  $schema['aggregator_category_item'] = array(
    'fields' => array(
      'iid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'cid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('iid', 'cid'),
  );

  $schema['aggregator_feed'] = array(
    'fields' => array(
      'fid'         => array('type' => 'serial', 'not null' => TRUE),
      'title'       => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'url'         => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'refresh'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'checked'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'link'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'description' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'image'       => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'etag'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'modified'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'block'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
    ),
    'unique keys' => array(
      'url'  => array('url'),
      'title' => array('title')
    ),
    'primary key' => array('fid'),
  );

  $schema['aggregator_item'] = array(
    'fields' => array(
      'iid'         => array('type' => 'serial', 'not null' => TRUE),
      'fid'         => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'title'       => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'link'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'author'      => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'description' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'timestamp'   => array('type' => 'int', 'not null' => FALSE),
      'guid'        => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE)
    ),
    'indexes' => array('fid' => array('fid')),
    'primary key' => array('iid'),
  );

  return $schema;
}