| 1 |
<?php
|
| 2 |
// $Id: feedapi_aggregator.install,v 1.2 2007/07/24 13:58:02 alexb Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function feedapi_aggregator_install() {
|
| 8 |
switch ($GLOBALS['db_type']) {
|
| 9 |
case 'mysql':
|
| 10 |
case 'mysqli':
|
| 11 |
db_query("CREATE TABLE IF NOT EXISTS {aggregator_category} (
|
| 12 |
cid int NOT NULL auto_increment,
|
| 13 |
title varchar(255) NOT NULL default '',
|
| 14 |
description longtext NOT NULL,
|
| 15 |
block tinyint NOT NULL default '0',
|
| 16 |
PRIMARY KEY (cid),
|
| 17 |
UNIQUE KEY title (title)
|
| 18 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 19 |
|
| 20 |
db_query("CREATE TABLE IF NOT EXISTS {aggregator_category_feed} (
|
| 21 |
fid int NOT NULL default '0',
|
| 22 |
cid int NOT NULL default '0',
|
| 23 |
PRIMARY KEY (fid,cid)
|
| 24 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 25 |
|
| 26 |
db_query("CREATE TABLE IF NOT EXISTS {aggregator_category_item} (
|
| 27 |
iid int NOT NULL default '0',
|
| 28 |
cid int NOT NULL default '0',
|
| 29 |
PRIMARY KEY (iid,cid)
|
| 30 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 31 |
|
| 32 |
db_query("CREATE TABLE IF NOT EXISTS {aggregator_feed} (
|
| 33 |
fid int NOT NULL auto_increment,
|
| 34 |
title varchar(255) NOT NULL default '',
|
| 35 |
url varchar(255) NOT NULL default '',
|
| 36 |
refresh int NOT NULL default '0',
|
| 37 |
checked int NOT NULL default '0',
|
| 38 |
link varchar(255) NOT NULL default '',
|
| 39 |
description longtext NOT NULL,
|
| 40 |
image longtext NOT NULL,
|
| 41 |
etag varchar(255) NOT NULL default '',
|
| 42 |
modified int NOT NULL default '0',
|
| 43 |
block tinyint NOT NULL default '0',
|
| 44 |
PRIMARY KEY (fid),
|
| 45 |
UNIQUE KEY link (url),
|
| 46 |
UNIQUE KEY title (title)
|
| 47 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 48 |
|
| 49 |
db_query("CREATE TABLE IF NOT EXISTS {aggregator_item} (
|
| 50 |
iid int NOT NULL auto_increment,
|
| 51 |
fid int NOT NULL default '0',
|
| 52 |
title varchar(255) NOT NULL default '',
|
| 53 |
link varchar(255) NOT NULL default '',
|
| 54 |
author varchar(255) NOT NULL default '',
|
| 55 |
description longtext NOT NULL,
|
| 56 |
timestamp int default NULL,
|
| 57 |
guid varchar(255),
|
| 58 |
PRIMARY KEY (iid),
|
| 59 |
KEY fid (fid)
|
| 60 |
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
|
| 61 |
|
| 62 |
break;
|
| 63 |
case 'pgsql':
|
| 64 |
db_query("CREATE TABLE {aggregator_category} (
|
| 65 |
cid serial,
|
| 66 |
title varchar(255) NOT NULL default '',
|
| 67 |
description text NOT NULL,
|
| 68 |
block smallint NOT NULL default '0',
|
| 69 |
PRIMARY KEY (cid),
|
| 70 |
UNIQUE (title)
|
| 71 |
)");
|
| 72 |
|
| 73 |
db_query("CREATE TABLE {aggregator_category_feed} (
|
| 74 |
fid int NOT NULL default '0',
|
| 75 |
cid int NOT NULL default '0',
|
| 76 |
PRIMARY KEY (fid,cid)
|
| 77 |
)");
|
| 78 |
|
| 79 |
db_query("CREATE TABLE {aggregator_category_item} (
|
| 80 |
iid int NOT NULL default '0',
|
| 81 |
cid int NOT NULL default '0',
|
| 82 |
PRIMARY KEY (iid,cid)
|
| 83 |
)");
|
| 84 |
|
| 85 |
db_query("CREATE TABLE {aggregator_feed} (
|
| 86 |
fid serial,
|
| 87 |
title varchar(255) NOT NULL default '',
|
| 88 |
url varchar(255) NOT NULL default '',
|
| 89 |
refresh int NOT NULL default '0',
|
| 90 |
checked int NOT NULL default '0',
|
| 91 |
link varchar(255) NOT NULL default '',
|
| 92 |
description text NOT NULL default '',
|
| 93 |
image text NOT NULL default '',
|
| 94 |
etag varchar(255) NOT NULL default '',
|
| 95 |
modified int NOT NULL default '0',
|
| 96 |
block smallint NOT NULL default '0',
|
| 97 |
PRIMARY KEY (fid),
|
| 98 |
UNIQUE (url),
|
| 99 |
UNIQUE (title)
|
| 100 |
)");
|
| 101 |
|
| 102 |
db_query("CREATE TABLE {aggregator_item} (
|
| 103 |
iid serial,
|
| 104 |
fid int NOT NULL default '0',
|
| 105 |
title varchar(255) NOT NULL default '',
|
| 106 |
link varchar(255) NOT NULL default '',
|
| 107 |
author varchar(255) NOT NULL default '',
|
| 108 |
description text NOT NULL,
|
| 109 |
timestamp int default NULL,
|
| 110 |
guid varchar(255),
|
| 111 |
PRIMARY KEY (iid)
|
| 112 |
)");
|
| 113 |
db_query("CREATE INDEX {aggregator_item}_fid_idx ON {aggregator_item} (fid)");
|
| 114 |
|
| 115 |
break;
|
| 116 |
}
|
| 117 |
}
|
| 118 |
|
| 119 |
/**
|
| 120 |
* Implementation of hook_uninstall().
|
| 121 |
*/
|
| 122 |
function feedapi_aggregator_uninstall() {
|
| 123 |
db_query('DROP TABLE {aggregator_category}');
|
| 124 |
db_query('DROP TABLE {aggregator_category_feed}');
|
| 125 |
db_query('DROP TABLE {aggregator_category_item}');
|
| 126 |
db_query('DROP TABLE {aggregator_feed}');
|
| 127 |
db_query('DROP TABLE {aggregator_item}');
|
| 128 |
variable_del('aggregator_allowed_html_tags');
|
| 129 |
variable_del('aggregator_summary_items');
|
| 130 |
variable_del('aggregator_clear');
|
| 131 |
variable_del('aggregator_category_selector');
|
| 132 |
}
|