webmaster@1
|
1 <?php |
franck@19
|
2 // $Id: aggregator.install,v 1.14.2.2 2009/01/06 15:46:36 goba Exp $ |
webmaster@1
|
3 |
webmaster@1
|
4 /** |
webmaster@1
|
5 * Implementation of hook_install(). |
webmaster@1
|
6 */ |
webmaster@1
|
7 function aggregator_install() { |
webmaster@1
|
8 // Create tables. |
webmaster@1
|
9 drupal_install_schema('aggregator'); |
webmaster@1
|
10 } |
webmaster@1
|
11 |
webmaster@1
|
12 /** |
webmaster@1
|
13 * Implementation of hook_uninstall(). |
webmaster@1
|
14 */ |
webmaster@1
|
15 function aggregator_uninstall() { |
webmaster@1
|
16 // Remove tables. |
webmaster@1
|
17 drupal_uninstall_schema('aggregator'); |
webmaster@1
|
18 |
webmaster@1
|
19 variable_del('aggregator_allowed_html_tags'); |
webmaster@1
|
20 variable_del('aggregator_summary_items'); |
webmaster@1
|
21 variable_del('aggregator_clear'); |
webmaster@1
|
22 variable_del('aggregator_category_selector'); |
webmaster@1
|
23 } |
webmaster@1
|
24 |
webmaster@1
|
25 /** |
webmaster@1
|
26 * Implementation of hook_schema(). |
webmaster@1
|
27 */ |
webmaster@1
|
28 function aggregator_schema() { |
webmaster@1
|
29 $schema['aggregator_category'] = array( |
franck@19
|
30 'description' => 'Stores categories for aggregator feeds and feed items.', |
webmaster@1
|
31 'fields' => array( |
webmaster@1
|
32 'cid' => array( |
webmaster@1
|
33 'type' => 'serial', |
webmaster@1
|
34 'not null' => TRUE, |
franck@19
|
35 'description' => 'Primary Key: Unique aggregator category ID.', |
webmaster@1
|
36 ), |
webmaster@1
|
37 'title' => array( |
webmaster@1
|
38 'type' => 'varchar', |
webmaster@1
|
39 'length' => 255, |
webmaster@1
|
40 'not null' => TRUE, |
webmaster@1
|
41 'default' => '', |
franck@19
|
42 'description' => 'Title of the category.', |
webmaster@1
|
43 ), |
webmaster@1
|
44 'description' => array( |
webmaster@1
|
45 'type' => 'text', |
webmaster@1
|
46 'not null' => TRUE, |
webmaster@1
|
47 'size' => 'big', |
franck@19
|
48 'description' => 'Description of the category', |
webmaster@1
|
49 ), |
webmaster@1
|
50 'block' => array( |
webmaster@1
|
51 'type' => 'int', |
webmaster@1
|
52 'not null' => TRUE, |
webmaster@1
|
53 'default' => 0, |
webmaster@1
|
54 'size' => 'tiny', |
franck@19
|
55 'description' => 'The number of recent items to show within the category block.', |
webmaster@1
|
56 ) |
webmaster@1
|
57 ), |
webmaster@1
|
58 'primary key' => array('cid'), |
webmaster@1
|
59 'unique keys' => array('title' => array('title')), |
webmaster@1
|
60 ); |
webmaster@1
|
61 |
webmaster@1
|
62 $schema['aggregator_category_feed'] = array( |
franck@19
|
63 'description' => 'Bridge table; maps feeds to categories.', |
webmaster@1
|
64 'fields' => array( |
webmaster@1
|
65 'fid' => array( |
webmaster@1
|
66 'type' => 'int', |
webmaster@1
|
67 'not null' => TRUE, |
webmaster@1
|
68 'default' => 0, |
franck@19
|
69 'description' => "The feed's {aggregator_feed}.fid.", |
webmaster@1
|
70 ), |
webmaster@1
|
71 'cid' => array( |
webmaster@1
|
72 'type' => 'int', |
webmaster@1
|
73 'not null' => TRUE, |
webmaster@1
|
74 'default' => 0, |
franck@19
|
75 'description' => 'The {aggregator_category}.cid to which the feed is being assigned.', |
webmaster@1
|
76 ) |
webmaster@1
|
77 ), |
webmaster@1
|
78 'primary key' => array('cid', 'fid'), |
webmaster@1
|
79 'indexes' => array('fid' => array('fid')), |
webmaster@1
|
80 ); |
webmaster@1
|
81 |
webmaster@1
|
82 $schema['aggregator_category_item'] = array( |
franck@19
|
83 'description' => 'Bridge table; maps feed items to categories.', |
webmaster@1
|
84 'fields' => array( |
webmaster@1
|
85 'iid' => array( |
webmaster@1
|
86 'type' => 'int', |
webmaster@1
|
87 'not null' => TRUE, |
webmaster@1
|
88 'default' => 0, |
franck@19
|
89 'description' => "The feed item's {aggregator_item}.iid.", |
webmaster@1
|
90 ), |
webmaster@1
|
91 'cid' => array( |
webmaster@1
|
92 'type' => 'int', |
webmaster@1
|
93 'not null' => TRUE, |
webmaster@1
|
94 'default' => 0, |
franck@19
|
95 'description' => 'The {aggregator_category}.cid to which the feed item is being assigned.', |
webmaster@1
|
96 ) |
webmaster@1
|
97 ), |
webmaster@1
|
98 'primary key' => array('cid', 'iid'), |
webmaster@1
|
99 'indexes' => array('iid' => array('iid')), |
webmaster@1
|
100 ); |
webmaster@1
|
101 |
webmaster@1
|
102 $schema['aggregator_feed'] = array( |
franck@19
|
103 'description' => 'Stores feeds to be parsed by the aggregator.', |
webmaster@1
|
104 'fields' => array( |
webmaster@1
|
105 'fid' => array( |
webmaster@1
|
106 'type' => 'serial', |
webmaster@1
|
107 'not null' => TRUE, |
franck@19
|
108 'description' => 'Primary Key: Unique feed ID.', |
webmaster@1
|
109 ), |
webmaster@1
|
110 'title' => array( |
webmaster@1
|
111 'type' => 'varchar', |
webmaster@1
|
112 'length' => 255, |
webmaster@1
|
113 'not null' => TRUE, |
webmaster@1
|
114 'default' => '', |
franck@19
|
115 'description' => 'Title of the feed.', |
webmaster@1
|
116 ), |
webmaster@1
|
117 'url' => array( |
webmaster@1
|
118 'type' => 'varchar', |
webmaster@1
|
119 'length' => 255, |
webmaster@1
|
120 'not null' => TRUE, |
webmaster@1
|
121 'default' => '', |
franck@19
|
122 'description' => 'URL to the feed.', |
webmaster@1
|
123 ), |
webmaster@1
|
124 'refresh' => array( |
webmaster@1
|
125 'type' => 'int', |
webmaster@1
|
126 'not null' => TRUE, |
webmaster@1
|
127 'default' => 0, |
franck@19
|
128 'description' => 'How often to check for new feed items, in seconds.', |
webmaster@1
|
129 ), |
webmaster@1
|
130 'checked' => array( |
webmaster@1
|
131 'type' => 'int', |
webmaster@1
|
132 'not null' => TRUE, |
webmaster@1
|
133 'default' => 0, |
franck@19
|
134 'description' => 'Last time feed was checked for new items, as Unix timestamp.', |
webmaster@1
|
135 ), |
webmaster@1
|
136 'link' => array( |
webmaster@1
|
137 'type' => 'varchar', |
webmaster@1
|
138 'length' => 255, |
webmaster@1
|
139 'not null' => TRUE, |
webmaster@1
|
140 'default' => '', |
franck@19
|
141 'description' => 'The parent website of the feed; comes from the <link> element in the feed.', |
webmaster@1
|
142 ), |
webmaster@1
|
143 'description' => array( |
webmaster@1
|
144 'type' => 'text', |
webmaster@1
|
145 'not null' => TRUE, |
webmaster@1
|
146 'size' => 'big', |
franck@19
|
147 'description' => "The parent website's description; comes from the <description> element in the feed.", |
webmaster@1
|
148 ), |
webmaster@1
|
149 'image' => array( |
webmaster@1
|
150 'type' => 'text', |
webmaster@1
|
151 'not null' => TRUE, |
webmaster@1
|
152 'size' => 'big', |
franck@19
|
153 'description' => 'An image representing the feed.', |
webmaster@1
|
154 ), |
webmaster@1
|
155 'etag' => array( |
webmaster@1
|
156 'type' => 'varchar', |
webmaster@1
|
157 'length' => 255, |
webmaster@1
|
158 'not null' => TRUE, |
webmaster@1
|
159 'default' => '', |
franck@19
|
160 'description' => 'Entity tag HTTP response header, used for validating cache.', |
webmaster@1
|
161 ), |
webmaster@1
|
162 'modified' => array( |
webmaster@1
|
163 'type' => 'int', |
webmaster@1
|
164 'not null' => TRUE, |
webmaster@1
|
165 'default' => 0, |
franck@19
|
166 'description' => 'When the feed was last modified, as a Unix timestamp.', |
webmaster@1
|
167 ), |
webmaster@1
|
168 'block' => array( |
webmaster@1
|
169 'type' => 'int', |
webmaster@1
|
170 'not null' => TRUE, |
webmaster@1
|
171 'default' => 0, |
webmaster@1
|
172 'size' => 'tiny', |
franck@19
|
173 'description' => "Number of items to display in the feed's block.", |
webmaster@1
|
174 ) |
webmaster@1
|
175 ), |
webmaster@1
|
176 'primary key' => array('fid'), |
webmaster@1
|
177 'unique keys' => array( |
webmaster@1
|
178 'url' => array('url'), |
webmaster@1
|
179 'title' => array('title'), |
webmaster@1
|
180 ), |
webmaster@1
|
181 ); |
webmaster@1
|
182 |
webmaster@1
|
183 $schema['aggregator_item'] = array( |
franck@19
|
184 'description' => 'Stores the individual items imported from feeds.', |
webmaster@1
|
185 'fields' => array( |
webmaster@1
|
186 'iid' => array( |
webmaster@1
|
187 'type' => 'serial', |
webmaster@1
|
188 'not null' => TRUE, |
franck@19
|
189 'description' => 'Primary Key: Unique ID for feed item.', |
webmaster@1
|
190 ), |
webmaster@1
|
191 'fid' => array( |
webmaster@1
|
192 'type' => 'int', |
webmaster@1
|
193 'not null' => TRUE, |
webmaster@1
|
194 'default' => 0, |
franck@19
|
195 'description' => 'The {aggregator_feed}.fid to which this item belongs.', |
webmaster@1
|
196 ), |
webmaster@1
|
197 'title' => array( |
webmaster@1
|
198 'type' => 'varchar', |
webmaster@1
|
199 'length' => 255, |
webmaster@1
|
200 'not null' => TRUE, |
webmaster@1
|
201 'default' => '', |
franck@19
|
202 'description' => 'Title of the feed item.', |
webmaster@1
|
203 ), |
webmaster@1
|
204 'link' => array( |
webmaster@1
|
205 'type' => 'varchar', |
webmaster@1
|
206 'length' => 255, |
webmaster@1
|
207 'not null' => TRUE, |
webmaster@1
|
208 'default' => '', |
franck@19
|
209 'description' => 'Link to the feed item.', |
webmaster@1
|
210 ), |
webmaster@1
|
211 'author' => array( |
webmaster@1
|
212 'type' => 'varchar', |
webmaster@1
|
213 'length' => 255, |
webmaster@1
|
214 'not null' => TRUE, |
webmaster@1
|
215 'default' => '', |
franck@19
|
216 'description' => 'Author of the feed item.', |
webmaster@1
|
217 ), |
webmaster@1
|
218 'description' => array( |
webmaster@1
|
219 'type' => 'text', |
webmaster@1
|
220 'not null' => TRUE, |
webmaster@1
|
221 'size' => 'big', |
franck@19
|
222 'description' => 'Body of the feed item.', |
webmaster@1
|
223 ), |
webmaster@1
|
224 'timestamp' => array( |
webmaster@1
|
225 'type' => 'int', |
webmaster@1
|
226 'not null' => FALSE, |
franck@19
|
227 'description' => 'Post date of feed item, as a Unix timestamp.', |
webmaster@1
|
228 ), |
webmaster@1
|
229 'guid' => array( |
webmaster@1
|
230 'type' => 'varchar', |
webmaster@1
|
231 'length' => 255, |
webmaster@1
|
232 'not null' => FALSE, |
franck@19
|
233 'description' => 'Unique identifier for the feed item.', |
webmaster@1
|
234 ) |
webmaster@1
|
235 ), |
webmaster@1
|
236 'primary key' => array('iid'), |
webmaster@1
|
237 'indexes' => array('fid' => array('fid')), |
webmaster@1
|
238 ); |
webmaster@1
|
239 |
webmaster@1
|
240 return $schema; |
webmaster@1
|
241 } |