| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: aggregation.install,v 1.3 2007/02/23 07:08:09 mistknight Exp $ |
// $Id: aggregation.install,v 1.4.2.16 2008/04/18 23:53:26 mistknight Exp $ |
| 4 |
|
|
| 5 |
function aggregation_install() |
function aggregation_install() |
| 6 |
{ |
{ |
| 13 |
CREATE TABLE IF NOT EXISTS {aggregation_feed} ( |
CREATE TABLE IF NOT EXISTS {aggregation_feed} ( |
| 14 |
`nid` int(10) unsigned NOT NULL, |
`nid` int(10) unsigned NOT NULL, |
| 15 |
`original_author` varchar(100) NOT NULL default '', |
`original_author` varchar(100) NOT NULL default '', |
| 16 |
`url` varchar(125) NOT NULL, |
`url` varchar(250) NOT NULL, |
| 17 |
`username` varchar(50) NOT NULL default '', |
`username` varchar(50) NOT NULL default '', |
| 18 |
`password` varchar(50) NOT NULL default '', |
`password` varchar(50) NOT NULL default '', |
| 19 |
`refresh_interval` int(10) unsigned NOT NULL, |
`refresh_interval` int(10) unsigned NOT NULL, |
| 20 |
`title_as_guid_interval` int(10) unsigned NOT NULL, |
`title_as_guid_interval` int(10) unsigned NOT NULL, |
| 21 |
`enabled` enum('yes', 'no') NOT NULL default 'yes', |
`promote_to_frontpage` int(10) NOT NULL default 0, |
| 22 |
`publish_new_items` enum('yes', 'no') NOT NULL default 'yes', |
`time_to_live` int(10) NOT NULL default 0, |
|
`delete_old_items` enum('yes', 'no') NOT NULL default 'no', |
|
| 23 |
`item_categories` varchar(150) NOT NULL default '', |
`item_categories` varchar(150) NOT NULL default '', |
| 24 |
|
`aggregation_feed_options` text NOT NULL, |
| 25 |
`etag` varchar(255) NOT NULL default '', |
`etag` varchar(255) NOT NULL default '', |
| 26 |
`last_modified` int(11) NOT NULL default 0, |
`last_modified` int(11) NOT NULL default 0, |
| 27 |
`last_refreshed` int(11) NOT NULL default 0, |
`last_refreshed` int(11) NOT NULL default 0, |
| 34 |
$query = <<<begin_create_query |
$query = <<<begin_create_query |
| 35 |
CREATE TABLE IF NOT EXISTS {aggregation_item} ( |
CREATE TABLE IF NOT EXISTS {aggregation_item} ( |
| 36 |
`nid` int(10) unsigned NOT NULL, |
`nid` int(10) unsigned NOT NULL, |
| 37 |
`url` varchar(125) NOT NULL default '', |
`url` varchar(250) NOT NULL default '', |
| 38 |
|
`aggregation_item_options` text NOT NULL, |
| 39 |
`original_author` varchar(100) NOT NULL default '', |
`original_author` varchar(100) NOT NULL default '', |
| 40 |
`story_guid` int NOT NULL default 0, |
`original_comments` varchar(250) NOT NULL, |
| 41 |
|
`story_guid` int unsigned NOT NULL default 0, |
| 42 |
`fid` int(10) unsigned NOT NULL default 0, |
`fid` int(10) unsigned NOT NULL default 0, |
| 43 |
`image_id` int(10) unsigned NOT NULL default 0, |
`image_id` int(10) unsigned NOT NULL default 0, |
| 44 |
`image_guid` int NOT NULL default 0, |
`image_guid` int unsigned NOT NULL default 0, |
| 45 |
PRIMARY KEY (`nid`), |
PRIMARY KEY (`nid`), |
| 46 |
INDEX (`story_guid`), |
INDEX (`story_guid`), |
| 47 |
INDEX (`image_id`), |
INDEX (`image_id`), |
| 51 |
begin_create_query; |
begin_create_query; |
| 52 |
|
|
| 53 |
db_query($query); |
db_query($query); |
| 54 |
|
|
| 55 |
if (db_fetch_object(db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary} ". |
$vocab_count = db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary} ". |
| 56 |
"WHERE name = '%s'", 'Aggregation Feed Types'))->vid_count == 0) |
"WHERE name = '%s'", 'Aggregation Feed Types'); |
| 57 |
|
|
| 58 |
|
$vocab_count = db_fetch_object($vocab_count); |
| 59 |
|
$vocab_count = $vocab_count->vid_count; |
| 60 |
|
|
| 61 |
|
if ($vocab_count == 0) |
| 62 |
{ |
{ |
| 63 |
$vocab = array(); |
$vocab = array(); |
| 64 |
|
|
| 65 |
$vocab['name'] = 'Aggregation Feed Types'; |
$vocab['name'] = 'Aggregation Feed Types'; |
| 66 |
$vocab['description'] = 'All Aggregation Feed Types are to be declared as terms under this vocabulary'; |
$vocab['description'] = 'All Aggregation Feed Types are to be declared as terms under this vocabulary'; |
| 67 |
$vocab['help'] = 'Add terms that represent the feed types. For example, if you create a term called '. |
$vocab['help'] = 'Add terms that represent the feed types. Refer to readme for details.'; |
|
'RSS10 you"ll need to create a file RSS10.inc in the feed_handlers that implements a function called '. |
|
|
'_aggregation_RSS10_parse. This function will handle all feeds under this term! '. |
|
|
'Checkout the file default.inc and RSS20 for an example.'. |
|
| 68 |
$vocab['multiple'] = 0; |
$vocab['multiple'] = 0; |
| 69 |
$vocab['required'] = 1; |
$vocab['required'] = 1; |
| 70 |
$vocab['module'] = 'aggregation'; |
$vocab['module'] = 'aggregation'; |
| 71 |
$vocab['nodes']['aggregation_feed'] = 1; |
$vocab['nodes']['aggregation_feed'] = 1; |
| 72 |
$vocab['tags'] = 0; |
$vocab['tags'] = 0; |
| 73 |
$vocab['weight'] = 0; |
$vocab['weight'] = 0; |
| 74 |
|
|
| 75 |
taxonomy_save_vocabulary($vocab); |
taxonomy_save_vocabulary($vocab); |
| 76 |
|
|
| 77 |
variable_set('aggregation_current_vid', $vocab['vid']); |
variable_set('aggregation_current_vid', $vocab['vid']); |
| 78 |
|
|
| 79 |
$term = array(); |
$term = array(); |
| 80 |
|
|
| 81 |
$term['name'] = 'RSS20'; |
$term['name'] = 'RSS20'; |
| 82 |
$term['description'] = 'This is an RSS 2.0 feed handler'; |
$term['description'] = 'This is an RSS 2.0 feed handler'; |
| 83 |
$term['vid'] = $vocab['vid']; |
$term['vid'] = $vocab['vid']; |
| 84 |
$term['weight'] = 0; |
$term['weight'] = 0; |
| 85 |
|
|
| 86 |
|
taxonomy_save_term($term); |
| 87 |
|
|
| 88 |
|
unset($term); |
| 89 |
|
$term = array(); |
| 90 |
|
|
| 91 |
|
$term['name'] = 'ATOM10'; |
| 92 |
|
$term['description'] = 'This is an ATOM 1.0 feed handler'; |
| 93 |
|
$term['vid'] = $vocab['vid']; |
| 94 |
|
$term['weight'] = 0; |
| 95 |
|
|
| 96 |
|
taxonomy_save_term($term); |
| 97 |
|
|
| 98 |
|
unset($term); |
| 99 |
|
$term = array(); |
| 100 |
|
|
| 101 |
|
$term['name'] = 'RDF10'; |
| 102 |
|
$term['description'] = 'This is an RDF 1.0 feed handler'; |
| 103 |
|
$term['vid'] = $vocab['vid']; |
| 104 |
|
$term['weight'] = 0; |
| 105 |
|
|
| 106 |
taxonomy_save_term($term); |
taxonomy_save_term($term); |
| 107 |
} |
} |
| 108 |
break; |
break; |
| 109 |
} |
} |
| 110 |
|
|
| 111 |
|
aggregation_update_6(); |
| 112 |
} |
} |
| 113 |
|
|
| 114 |
|
//update function for 4.7 branch |
| 115 |
function aggregation_update_1() |
function aggregation_update_1() |
| 116 |
{ |
{ |
| 117 |
$ret = array(); |
$ret = array(); |
| 118 |
|
|
| 119 |
switch ($GLOBALS['db_type']) |
switch ($GLOBALS['db_type']) |
| 120 |
{ |
{ |
| 121 |
case 'mysql': |
case 'mysql': |
| 127 |
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD promote_to_frontpage int(10) NOT NULL default 0 AFTER enable_comments_on_images"); |
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD promote_to_frontpage int(10) NOT NULL default 0 AFTER enable_comments_on_images"); |
| 128 |
break; |
break; |
| 129 |
} |
} |
| 130 |
|
|
| 131 |
|
return $ret; |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
// update function for drupal 5 branch |
| 135 |
|
function aggregation_update_2() |
| 136 |
|
{ |
| 137 |
|
$ret = array(); |
| 138 |
|
|
| 139 |
|
switch ($GLOBALS['db_type']) |
| 140 |
|
{ |
| 141 |
|
case 'mysql': |
| 142 |
|
case 'mysqli': |
| 143 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD link_items_to_original_urls enum('yes', 'no') NOT NULL default 'yes' AFTER delete_old_items"); |
| 144 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD link_to_original_url enum('yes', 'no') NOT NULL default 'yes' AFTER url"); |
| 145 |
|
break; |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
return $ret; |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
function aggregation_update_3() |
| 152 |
|
{ |
| 153 |
|
$current_vid = variable_get('aggregation_current_vid', 0); |
| 154 |
|
if ($current_vid) |
| 155 |
|
{ |
| 156 |
|
$term_exists = taxonomy_get_term_by_name('ATOM10'); |
| 157 |
|
if (count($term_exists) > 0) return array(); |
| 158 |
|
|
| 159 |
|
$term = array(); |
| 160 |
|
|
| 161 |
|
$term['name'] = 'ATOM10'; |
| 162 |
|
$term['description'] = 'This is an ATOM 1.0 feed handler'; |
| 163 |
|
$term['vid'] = $current_vid; |
| 164 |
|
$term['weight'] = 0; |
| 165 |
|
|
| 166 |
|
taxonomy_save_term($term); |
| 167 |
|
} |
| 168 |
|
else |
| 169 |
|
drupal_set_message("Something wrong occurred during update! Please report this to module maintainer!"); |
| 170 |
|
|
| 171 |
|
return array(); |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
function aggregation_update_4() |
| 175 |
|
{ |
| 176 |
|
db_query("ALTER TABLE {aggregation_item} modify `story_guid` bigint"); |
| 177 |
|
db_query("ALTER TABLE {aggregation_item} modify `image_guid` bigint"); |
| 178 |
|
|
| 179 |
|
$original_items = db_query("SELECT * FROM {aggregation_item}"); |
| 180 |
|
|
| 181 |
|
while ($row = db_fetch_object($original_items)) |
| 182 |
|
{ |
| 183 |
|
$update_statement = ""; |
| 184 |
|
|
| 185 |
|
$new_story_guid = sprintf('%u', $row->story_guid); |
| 186 |
|
$new_image_guid = sprintf('%u', $row->image_guid); |
| 187 |
|
|
| 188 |
|
if ($row->story_guid != $new_story_guid) |
| 189 |
|
$update_statement .= "`story_guid` = $new_story_guid"; |
| 190 |
|
|
| 191 |
|
if ($row->image_guid != $new_image_guid) |
| 192 |
|
if ($update_statement == '') |
| 193 |
|
$update_statement .= "`image_guid` = $new_image_guid"; |
| 194 |
|
else |
| 195 |
|
$update_statement .= ",`image_guid` = $new_image_guid"; |
| 196 |
|
|
| 197 |
|
if ($update_statement == '') continue; |
| 198 |
|
|
| 199 |
|
db_query("UPDATE {aggregation_item} SET $update_statement WHERE nid = %d", $row->nid); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
db_query("ALTER TABLE {aggregation_item} modify `story_guid` int unsigned"); |
| 203 |
|
db_query("ALTER TABLE {aggregation_item} modify `image_guid` int unsigned"); |
| 204 |
|
|
| 205 |
|
return array(); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
function aggregation_update_5() |
| 209 |
|
{ |
| 210 |
|
$current_vid = variable_get('aggregation_current_vid', 0); |
| 211 |
|
if ($current_vid) |
| 212 |
|
{ |
| 213 |
|
$term_exists = taxonomy_get_term_by_name('RDF10'); |
| 214 |
|
if (count($term_exists) > 0) return array(); |
| 215 |
|
|
| 216 |
|
$term = array(); |
| 217 |
|
|
| 218 |
|
$term['name'] = 'RDF10'; |
| 219 |
|
$term['description'] = 'This is an RDF 1.0 feed handler'; |
| 220 |
|
$term['vid'] = $current_vid; |
| 221 |
|
$term['weight'] = 0; |
| 222 |
|
|
| 223 |
|
taxonomy_save_term($term); |
| 224 |
|
} |
| 225 |
|
else |
| 226 |
|
drupal_set_message("Something wrong occurred during update! Please report this to module maintainer!"); |
| 227 |
|
|
| 228 |
|
return array(); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
function aggregation_update_6() |
| 232 |
|
{ |
| 233 |
|
if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_feed') . "}'")) == 0) return; |
| 234 |
|
if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_item') . "}'")) == 0) return; |
| 235 |
|
|
| 236 |
|
if (!ini_get('safe_mode')) |
| 237 |
|
set_time_limit(30 * 60); |
| 238 |
|
|
| 239 |
|
db_query("UPDATE {vocabulary_node_types} SET type = '%s' WHERE type = '%s'", 'aggregation_feed', 'aggregator2_feed'); |
| 240 |
|
db_query("UPDATE {vocabulary_node_types} SET type = '%s' WHERE type = '%s'", 'aggregation_feed', 'aggregator2-feed'); |
| 241 |
|
db_query("UPDATE {vocabulary_node_types} SET type = '%s' WHERE type = '%s'", 'aggregation_item', 'aggregator2_item'); |
| 242 |
|
db_query("UPDATE {vocabulary_node_types} SET type = '%s' WHERE type = '%s'", 'aggregation_item', 'aggregator2-item'); |
| 243 |
|
|
| 244 |
|
$feeds = db_query("SELECT af.* FROM {aggregator2_feed} af, {node} n WHERE af.nid = n.nid"); |
| 245 |
|
|
| 246 |
|
while ($row = db_fetch_object($feeds)) |
| 247 |
|
{ |
| 248 |
|
if (db_fetch_object(db_query("SELECT COUNT(nid) AS feed_count FROM {aggregation_feed} WHERE url = '%s'", $row->url))->feed_count > 0) continue; |
| 249 |
|
|
| 250 |
|
db_query("UPDATE {node} SET type = '%s' WHERE nid = %d", 'aggregation_feed', $row->nid); |
| 251 |
|
|
| 252 |
|
$taxonomies_old_style = unserialize($row->item_taxonomy); |
| 253 |
|
|
| 254 |
|
$taxonomies_new_style = array(); |
| 255 |
|
|
| 256 |
|
foreach ($taxonomies_old_style AS $key => $value) |
| 257 |
|
{ |
| 258 |
|
$vid = db_query("SELECT vid FROM {term_data} WHERE tid = %d", $value); |
| 259 |
|
if (db_num_rows($vid) == 0) continue; |
| 260 |
|
$vid = db_fetch_object($vid)->vid; |
| 261 |
|
$taxonomies_new_style[$vid][$value] = $value; |
| 262 |
|
} |
| 263 |
|
|
| 264 |
|
$row->item_taxonomy = serialize($taxonomies_new_style); |
| 265 |
|
|
| 266 |
|
db_query("INSERT INTO {aggregation_feed} VALUES ". |
| 267 |
|
"(%d, '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d ,'%s', '%s', '%s', '%s', %d, %d)", |
| 268 |
|
$row->nid, $row->author, $row->url, '', '', (int)($row->refresh/60), 0, 'no', ($row->item_status ? 'yes' : 'no'), 'no', 'no', 'no', 'no', ($row->promoted_items == 1000000000 ? 0 : $row->promoted_items), ($row->clear_items == 1000000000 ? 'no' : 'yes'), ($row->item_show_link == 1 ? 'no' : 'yes'), $row->item_taxonomy, $row->etag, $row->modified, $row->checked); |
| 269 |
|
|
| 270 |
|
$items = db_query("SELECT ai.*, n.title FROM {aggregator2_item} ai, {node} n WHERE ai.fid = %d AND ai.nid = n.nid", $row->nid); |
| 271 |
|
while ($row2 = db_fetch_object($items)) |
| 272 |
|
{ |
| 273 |
|
db_query("UPDATE {node} SET type = '%s' WHERE nid = %d", 'aggregation_item', $row2->nid); |
| 274 |
|
|
| 275 |
|
$row2->guid = sprintf('%u', crc32(trim($row2->guid) == '' ? $row2->title : $row2->guid)); |
| 276 |
|
|
| 277 |
|
db_query("INSERT INTO {aggregation_item} (nid, url, link_to_original_url, original_author, ". |
| 278 |
|
"story_guid, fid, image_id, image_guid) VALUES (%d, '%s', '%s', '%s', %s, %d, ". |
| 279 |
|
"%d, %s)", $row2->nid, $row2->link, ($row->item_show_link == 1 ? 'no' : 'yes'),(trim($row2->author) == '' ? (trim($row->author) == '' ? 'unspecified' : $row->author): $row2->author), $row2->guid, $row2->fid, 0, 0); |
| 280 |
|
} |
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
db_query("DROP TABLE {aggregator2_feed}"); |
| 284 |
|
db_query("DROP TABLE {aggregator2_item}"); |
| 285 |
|
} |
| 286 |
|
|
| 287 |
|
//update function for 4.7 & 5 branch |
| 288 |
|
function aggregation_update_7() |
| 289 |
|
{ |
| 290 |
|
$ret = array(); |
| 291 |
|
|
| 292 |
|
switch ($GLOBALS['db_type']) |
| 293 |
|
{ |
| 294 |
|
case 'mysql': |
| 295 |
|
case 'mysqli': |
| 296 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} modify `url` varchar(250) NOT NULL"); |
| 297 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} modify `url` varchar(250) NOT NULL"); |
| 298 |
|
break; |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
return $ret; |
| 302 |
|
} |
| 303 |
|
|
| 304 |
|
|
| 305 |
|
function aggregation_update_8() |
| 306 |
|
{ |
| 307 |
|
$ret = array(); |
| 308 |
|
|
| 309 |
|
switch ($GLOBALS['db_type']) |
| 310 |
|
{ |
| 311 |
|
case 'mysql': |
| 312 |
|
case 'mysqli': |
| 313 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD aggregation_feed_options text NOT NULL AFTER item_categories"); |
| 314 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD time_to_live int(10) NOT NULL default 0 AFTER promote_to_frontpage"); |
| 315 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD aggregation_item_options text NOT NULL AFTER link_to_original_url"); |
| 316 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD original_comments varchar(250) NOT NULL AFTER original_author"); |
| 317 |
|
break; |
| 318 |
|
} |
| 319 |
|
|
| 320 |
|
$old_feed_data = db_query("SELECT * FROM {aggregation_feed}"); |
| 321 |
|
|
| 322 |
|
while ($row = db_fetch_object($old_feed_data)) |
| 323 |
|
{ |
| 324 |
|
$options_array = array(); |
| 325 |
|
|
| 326 |
|
$options_array['aggregate_to_moderation_queue'] = |
| 327 |
|
($row->aggregate_to_moderation_queue == 'yes' ? 1 : 0); |
| 328 |
|
$options_array['enable_comments_on_articles'] = |
| 329 |
|
($row->enable_comments_on_articles == 'yes' ? 1 : 0); |
| 330 |
|
$options_array['enable_comments_on_images'] = |
| 331 |
|
($row->enable_comments_on_images == 'yes' ? 1 : 0); |
| 332 |
|
$options_array['enabled'] = |
| 333 |
|
($row->enabled == 'yes' ? 1 : 0); |
| 334 |
|
$options_array['link_items_to_original_urls'] = |
| 335 |
|
($row->link_items_to_original_urls == 'yes' ? 1 : 0); |
| 336 |
|
$options_array['publish_new_items'] = |
| 337 |
|
($row->publish_new_items == 'yes' ? 1 : 0); |
| 338 |
|
$options_array['sticky_items'] = |
| 339 |
|
($row->sticky_items == 'yes' ? 1 : 0); |
| 340 |
|
|
| 341 |
|
$time_to_live = 0; |
| 342 |
|
|
| 343 |
|
if ($row->delete_old_items == 'yes') |
| 344 |
|
$time_to_live = variable_get('aggregation_item_time_to_live', 30); |
| 345 |
|
|
| 346 |
|
$options_array = serialize($options_array); |
| 347 |
|
|
| 348 |
|
db_query("UPDATE {aggregation_feed} SET aggregation_feed_options = '%s', time_to_live = %d WHERE nid = %d", $options_array, $time_to_live, $row->nid); |
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
$old_feed_data = db_query("SELECT * FROM {aggregation_item}"); |
| 352 |
|
|
| 353 |
|
while ($row = db_fetch_object($old_feed_data)) |
| 354 |
|
{ |
| 355 |
|
$options_array = array(); |
| 356 |
|
|
| 357 |
|
$options_array['link_to_original_url'] = |
| 358 |
|
($row->link_to_original_url == 'yes' ? 1 : 0); |
| 359 |
|
|
| 360 |
|
$options_array = serialize($options_array); |
| 361 |
|
|
| 362 |
|
db_query("UPDATE {aggregation_item} SET aggregation_item_options = '%s' WHERE nid = %d", $options_array, $row->nid); |
| 363 |
|
} |
| 364 |
|
|
| 365 |
|
switch ($GLOBALS['db_type']) |
| 366 |
|
{ |
| 367 |
|
case 'mysql': |
| 368 |
|
case 'mysqli': |
| 369 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN aggregate_to_moderation_queue"); |
| 370 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enable_comments_on_articles"); |
| 371 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enable_comments_on_images"); |
| 372 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enabled"); |
| 373 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN link_items_to_original_urls"); |
| 374 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN publish_new_items"); |
| 375 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN sticky_items"); |
| 376 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN delete_old_items"); |
| 377 |
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} DROP COLUMN link_to_original_url"); |
| 378 |
|
break; |
| 379 |
|
} |
| 380 |
|
|
| 381 |
|
variable_del('aggregation_item_time_to_live'); |
| 382 |
|
|
| 383 |
return $ret; |
return $ret; |
| 384 |
} |
} |
| 385 |
|
|
| 389 |
$result = db_query("SELECT ai.nid FROM {aggregation_item} ai, {node} n WHERE ai.nid = n.nid"); |
$result = db_query("SELECT ai.nid FROM {aggregation_item} ai, {node} n WHERE ai.nid = n.nid"); |
| 390 |
while ($row = db_fetch_object($result)) |
while ($row = db_fetch_object($result)) |
| 391 |
node_delete($row->nid); |
node_delete($row->nid); |
| 392 |
|
|
| 393 |
// Delete all aggregation feeds |
// Delete all aggregation feeds |
| 394 |
$result = db_query("SELECT af.nid FROM {aggregation_feed} af, {node} n WHERE af.nid = n.nid"); |
$result = db_query("SELECT af.nid FROM {aggregation_feed} af, {node} n WHERE af.nid = n.nid"); |
| 395 |
while ($row = db_fetch_object($result)) |
while ($row = db_fetch_object($result)) |
| 396 |
node_delete($row->nid); |
node_delete($row->nid); |
| 397 |
|
|
| 398 |
// We'll get -1 if this is not set for some reason |
// We'll get -1 if this is not set for some reason |
| 399 |
$vocabulary_to_delete = variable_get('aggregation_current_vid', -1); |
$vocabulary_to_delete = variable_get('aggregation_current_vid', -1); |
| 400 |
|
|
| 401 |
if ($vocabulary_to_delete >= 0) |
if ($vocabulary_to_delete >= 0) |
| 402 |
taxonomy_del_vocabulary($vocabulary_to_delete); |
taxonomy_del_vocabulary($vocabulary_to_delete); |
| 403 |
|
|
| 404 |
db_query("DROP TABLE {aggregation_item}"); |
db_query("DROP TABLE {aggregation_item}"); |
| 405 |
db_query("DROP TABLE {aggregation_feed}"); |
db_query("DROP TABLE {aggregation_feed}"); |
| 406 |
variable_del('aggregation_current_vid'); |
variable_del('aggregation_current_vid'); |
| 410 |
variable_del('aggregation_enable_cron'); |
variable_del('aggregation_enable_cron'); |
| 411 |
variable_del('aggregation_feeds_to_refresh_per_cron'); |
variable_del('aggregation_feeds_to_refresh_per_cron'); |
| 412 |
variable_del('aggregation_feed_refresh_cooldown'); |
variable_del('aggregation_feed_refresh_cooldown'); |
| 413 |
|
|
| 414 |
node_type_delete('aggregation_feed'); |
node_type_delete('aggregation_feed'); |
| 415 |
node_type_delete('aggregation_item'); |
node_type_delete('aggregation_item'); |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
/** |
| 419 |
|
* Implementation of hook_requirements |
| 420 |
|
*/ |
| 421 |
|
function aggregation_requirements($phase) |
| 422 |
|
{ |
| 423 |
|
$requirements = array(); |
| 424 |
|
|
| 425 |
|
// Ensure translations don't break at install time |
| 426 |
|
$t = get_t(); |
| 427 |
|
|
| 428 |
|
// Test PHP version |
| 429 |
|
$requirements['PHP'] = array( |
| 430 |
|
'title' => $t('PHP'), |
| 431 |
|
'value' => ($phase == 'runtime') ? l(phpversion(), 'admin/logs/status/php') : |
| 432 |
|
phpversion(), |
| 433 |
|
); |
| 434 |
|
|
| 435 |
|
if (version_compare(phpversion(), '5.0.0') < 0) |
| 436 |
|
{ |
| 437 |
|
$requirements['PHP']['description'] = $t('This module requires at least PHP %version.', array('%version' => '5.0.0')); |
| 438 |
|
$requirements['PHP']['severity'] = REQUIREMENT_ERROR; |
| 439 |
|
} |
| 440 |
|
|
| 441 |
|
$requirements['CURL'] = array(); |
| 442 |
|
$requirements['CURL']['title'] = $t('CURL'); |
| 443 |
|
$requirements['CURL']['value'] = $t('INSTALLED'); |
| 444 |
|
|
| 445 |
|
// Test for CURL support |
| 446 |
|
if (!function_exists('curl_init')) |
| 447 |
|
{ |
| 448 |
|
$requirements['CURL']['value'] = $t('NOT INSTALLED'); |
| 449 |
|
$requirements['CURL']['description'] = $t('CURL support not present.'); |
| 450 |
|
$requirements['CURL']['severity'] = REQUIREMENT_ERROR; |
| 451 |
|
} |
| 452 |
|
|
| 453 |
|
$requirements['DRUPAL'] = array(); |
| 454 |
|
$requirements['DRUPAL']['title'] = $t('Drupal'); |
| 455 |
|
$requirements['DRUPAL']['value'] = VERSION; |
| 456 |
|
|
| 457 |
|
// Test drupal version support |
| 458 |
|
if (strpos(VERSION, '5.') !== 0) |
| 459 |
|
{ |
| 460 |
|
$requirements['DRUPAL']['description'] = $t('Drupal version incompatible with this module.'); |
| 461 |
|
$requirements['DRUPAL']['severity'] = REQUIREMENT_ERROR; |
| 462 |
|
} |
| 463 |
|
|
| 464 |
|
return $requirements; |
| 465 |
} |
} |