| 4 |
|
|
| 5 |
function aggregation_install() |
function aggregation_install() |
| 6 |
{ |
{ |
| 7 |
switch ($GLOBALS['db_type']) |
drupal_install_schema('aggregation'); |
| 8 |
|
|
| 9 |
|
$vocab_count = db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary} ". |
| 10 |
|
"WHERE name = '%s'", 'Aggregation Feed Types'); |
| 11 |
|
|
| 12 |
|
$vocab_count = db_fetch_object($vocab_count); |
| 13 |
|
$vocab_count = $vocab_count->vid_count; |
| 14 |
|
|
| 15 |
|
if ($vocab_count == 0) |
| 16 |
{ |
{ |
| 17 |
case 'mysqli': |
$vocab = array(); |
|
case 'mysql': |
|
| 18 |
|
|
| 19 |
$query = <<<begin_create_query |
$vocab['name'] = 'Aggregation Feed Types'; |
| 20 |
CREATE TABLE IF NOT EXISTS {aggregation_feed} ( |
$vocab['description'] = 'All Aggregation Feed Types are to be declared as terms under this vocabulary'; |
| 21 |
`nid` int(10) unsigned NOT NULL, |
$vocab['help'] = 'Add terms that represent the feed types. Refer to readme for details.'; |
| 22 |
`original_author` varchar(100) NOT NULL default '', |
$vocab['multiple'] = 0; |
| 23 |
`url` varchar(250) NOT NULL, |
$vocab['required'] = 1; |
| 24 |
`username` varchar(50) NOT NULL default '', |
$vocab['module'] = 'aggregation'; |
| 25 |
`password` varchar(50) NOT NULL default '', |
$vocab['nodes']['aggregation_feed'] = 1; |
| 26 |
`refresh_interval` int(10) unsigned NOT NULL, |
$vocab['tags'] = 0; |
| 27 |
`title_as_guid_interval` int(10) unsigned NOT NULL, |
$vocab['weight'] = 0; |
|
`promote_to_frontpage` int(10) NOT NULL default 0, |
|
|
`time_to_live` int(10) NOT NULL default 0, |
|
|
`item_categories` varchar(150) NOT NULL default '', |
|
|
`aggregation_feed_options` text NOT NULL, |
|
|
`etag` varchar(255) NOT NULL default '', |
|
|
`last_modified` int(11) NOT NULL default 0, |
|
|
`last_refreshed` int(11) NOT NULL default 0, |
|
|
PRIMARY KEY (`nid`) |
|
|
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */; |
|
|
begin_create_query; |
|
|
|
|
|
db_query($query); |
|
|
|
|
|
$query = <<<begin_create_query |
|
|
CREATE TABLE IF NOT EXISTS {aggregation_item} ( |
|
|
`nid` int(10) unsigned NOT NULL, |
|
|
`url` varchar(250) NOT NULL default '', |
|
|
`aggregation_item_options` text NOT NULL, |
|
|
`original_author` varchar(100) NOT NULL default '', |
|
|
`original_comments` varchar(250) NOT NULL, |
|
|
`story_guid` int unsigned NOT NULL default 0, |
|
|
`fid` int(10) unsigned NOT NULL default 0, |
|
|
`image_id` int(10) unsigned NOT NULL default 0, |
|
|
`image_guid` int unsigned NOT NULL default 0, |
|
|
PRIMARY KEY (`nid`), |
|
|
INDEX (`story_guid`), |
|
|
INDEX (`image_id`), |
|
|
INDEX (`fid`), |
|
|
INDEX (`image_guid`) |
|
|
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */; |
|
|
begin_create_query; |
|
|
|
|
|
db_query($query); |
|
|
|
|
|
$vocab_count = db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary} ". |
|
|
"WHERE name = '%s'", 'Aggregation Feed Types'); |
|
|
|
|
|
$vocab_count = db_fetch_object($vocab_count); |
|
|
$vocab_count = $vocab_count->vid_count; |
|
|
|
|
|
if ($vocab_count == 0) |
|
|
{ |
|
|
$vocab = array(); |
|
|
|
|
|
$vocab['name'] = 'Aggregation Feed Types'; |
|
|
$vocab['description'] = 'All Aggregation Feed Types are to be declared as terms under this vocabulary'; |
|
|
$vocab['help'] = 'Add terms that represent the feed types. Refer to readme for details.'; |
|
|
$vocab['multiple'] = 0; |
|
|
$vocab['required'] = 1; |
|
|
$vocab['module'] = 'aggregation'; |
|
|
$vocab['nodes']['aggregation_feed'] = 1; |
|
|
$vocab['tags'] = 0; |
|
|
$vocab['weight'] = 0; |
|
|
|
|
|
taxonomy_save_vocabulary($vocab); |
|
|
|
|
|
variable_set('aggregation_current_vid', $vocab['vid']); |
|
|
|
|
|
$term = array(); |
|
|
|
|
|
$term['name'] = 'RSS20'; |
|
|
$term['description'] = 'This is an RSS 2.0 feed handler'; |
|
|
$term['vid'] = $vocab['vid']; |
|
|
$term['weight'] = 0; |
|
|
|
|
|
taxonomy_save_term($term); |
|
|
|
|
|
unset($term); |
|
|
$term = array(); |
|
|
|
|
|
$term['name'] = 'ATOM10'; |
|
|
$term['description'] = 'This is an ATOM 1.0 feed handler'; |
|
|
$term['vid'] = $vocab['vid']; |
|
|
$term['weight'] = 0; |
|
|
|
|
|
taxonomy_save_term($term); |
|
|
|
|
|
unset($term); |
|
|
$term = array(); |
|
|
|
|
|
$term['name'] = 'RDF10'; |
|
|
$term['description'] = 'This is an RDF 1.0 feed handler'; |
|
|
$term['vid'] = $vocab['vid']; |
|
|
$term['weight'] = 0; |
|
|
|
|
|
taxonomy_save_term($term); |
|
|
} |
|
|
break; |
|
|
} |
|
| 28 |
|
|
| 29 |
aggregation_update_6(); |
taxonomy_save_vocabulary($vocab); |
|
} |
|
| 30 |
|
|
| 31 |
//update function for 4.7 branch |
variable_set('aggregation_current_vid', $vocab['vid']); |
|
function aggregation_update_1() |
|
|
{ |
|
|
$ret = array(); |
|
| 32 |
|
|
| 33 |
switch ($GLOBALS['db_type']) |
$term = array(); |
|
{ |
|
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD aggregate_to_moderation_queue enum('yes', 'no') NOT NULL default 'no' AFTER publish_new_items"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD sticky_items enum('yes', 'no') NOT NULL default 'no' AFTER aggregate_to_moderation_queue"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD enable_comments_on_articles enum('yes','no') NOT NULL default 'no' AFTER sticky_items"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD enable_comments_on_images enum('yes','no') NOT NULL default 'no' AFTER enable_comments_on_articles"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD promote_to_frontpage int(10) NOT NULL default 0 AFTER enable_comments_on_images"); |
|
|
break; |
|
|
} |
|
| 34 |
|
|
| 35 |
return $ret; |
$term['name'] = 'RSS20'; |
| 36 |
} |
$term['description'] = 'This is an RSS 2.0 feed handler'; |
| 37 |
|
$term['vid'] = $vocab['vid']; |
| 38 |
|
$term['weight'] = 0; |
| 39 |
|
|
| 40 |
// update function for drupal 5 branch |
taxonomy_save_term($term); |
|
function aggregation_update_2() |
|
|
{ |
|
|
$ret = array(); |
|
| 41 |
|
|
| 42 |
switch ($GLOBALS['db_type']) |
unset($term); |
| 43 |
{ |
$term = array(); |
| 44 |
case 'mysql': |
|
| 45 |
case 'mysqli': |
$term['name'] = 'ATOM10'; |
| 46 |
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD link_items_to_original_urls enum('yes', 'no') NOT NULL default 'yes' AFTER delete_old_items"); |
$term['description'] = 'This is an ATOM 1.0 feed handler'; |
| 47 |
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD link_to_original_url enum('yes', 'no') NOT NULL default 'yes' AFTER url"); |
$term['vid'] = $vocab['vid']; |
| 48 |
break; |
$term['weight'] = 0; |
| 49 |
|
|
| 50 |
|
taxonomy_save_term($term); |
| 51 |
|
|
| 52 |
|
unset($term); |
| 53 |
|
$term = array(); |
| 54 |
|
|
| 55 |
|
$term['name'] = 'RDF10'; |
| 56 |
|
$term['description'] = 'This is an RDF 1.0 feed handler'; |
| 57 |
|
$term['vid'] = $vocab['vid']; |
| 58 |
|
$term['weight'] = 0; |
| 59 |
|
|
| 60 |
|
taxonomy_save_term($term); |
| 61 |
} |
} |
| 62 |
|
|
| 63 |
return $ret; |
aggregation_update_6(); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
function aggregation_schema() { |
| 67 |
|
$schema['aggregation_feed'] = array( |
| 68 |
|
'fields' => array( |
| 69 |
|
'nid' => array( |
| 70 |
|
'type' => 'int', |
| 71 |
|
'size' => 'normal', |
| 72 |
|
'unsigned' => TRUE, |
| 73 |
|
'not null' => TRUE, |
| 74 |
|
), |
| 75 |
|
'original_author' => array( |
| 76 |
|
'type' => 'varchar', |
| 77 |
|
'length' => 100, |
| 78 |
|
'not null' => TRUE, |
| 79 |
|
'default' => '', |
| 80 |
|
), |
| 81 |
|
'url' => array( |
| 82 |
|
'type' => 'varchar', |
| 83 |
|
'length' => 250, |
| 84 |
|
'not null' => TRUE, |
| 85 |
|
), |
| 86 |
|
'username' => array( |
| 87 |
|
'type' => 'varchar', |
| 88 |
|
'length' => 50, |
| 89 |
|
'not null' => TRUE, |
| 90 |
|
'default' => '', |
| 91 |
|
), |
| 92 |
|
'password' => array( |
| 93 |
|
'type' => 'varchar', |
| 94 |
|
'length' => 50, |
| 95 |
|
'not null' => TRUE, |
| 96 |
|
'default' => '', |
| 97 |
|
), |
| 98 |
|
'refresh_interval' => array( |
| 99 |
|
'type' => 'int', |
| 100 |
|
'size' => 'normal', |
| 101 |
|
'unsigned' => TRUE, |
| 102 |
|
'not null' => TRUE, |
| 103 |
|
), |
| 104 |
|
'title_as_guid_interval' => array( |
| 105 |
|
'type' => 'int', |
| 106 |
|
'size' => 'normal', |
| 107 |
|
'unsigned' => TRUE, |
| 108 |
|
'not null' => TRUE, |
| 109 |
|
), |
| 110 |
|
'promote_to_frontpage' => array( |
| 111 |
|
'type' => 'int', |
| 112 |
|
'size' => 'normal', |
| 113 |
|
'not null' => TRUE, |
| 114 |
|
'default' => 0, |
| 115 |
|
), |
| 116 |
|
'time_to_live' => array( |
| 117 |
|
'type' => 'int', |
| 118 |
|
'size' => 'normal', |
| 119 |
|
'not null' => TRUE, |
| 120 |
|
'default' => 0, |
| 121 |
|
), |
| 122 |
|
'item_categories' => array( |
| 123 |
|
'type' => 'varchar', |
| 124 |
|
'length' => 150, |
| 125 |
|
'not null' => TRUE, |
| 126 |
|
'default' => '', |
| 127 |
|
), |
| 128 |
|
'aggregation_feed_options' => array( |
| 129 |
|
'type' => 'text', |
| 130 |
|
'not null' => TRUE, |
| 131 |
|
), |
| 132 |
|
'etag' => array( |
| 133 |
|
'type' => 'varchar', |
| 134 |
|
'length' => 255, |
| 135 |
|
'not null' => TRUE, |
| 136 |
|
'default' => '', |
| 137 |
|
), |
| 138 |
|
'last_modified' => array( |
| 139 |
|
'type' => 'int', |
| 140 |
|
'not null' => TRUE, |
| 141 |
|
'default' => 0, |
| 142 |
|
), |
| 143 |
|
'last_refreshed' => array( |
| 144 |
|
'type' => 'int', |
| 145 |
|
'not null' => TRUE, |
| 146 |
|
'default' => 0, |
| 147 |
|
), |
| 148 |
|
), |
| 149 |
|
'primary key' => array('nid'), |
| 150 |
|
); |
| 151 |
|
|
| 152 |
|
$schema['aggregation_item'] = array( |
| 153 |
|
'fields' => array( |
| 154 |
|
'nid' => array( |
| 155 |
|
'type' => 'int', |
| 156 |
|
'size' => 'normal', |
| 157 |
|
'unsigned' => TRUE, |
| 158 |
|
'not null' => TRUE), |
| 159 |
|
'url' => array( |
| 160 |
|
'type' => 'varchar', |
| 161 |
|
'length' => 250, |
| 162 |
|
'not null' => TRUE, |
| 163 |
|
'default' => '', |
| 164 |
|
), |
| 165 |
|
'aggregation_item_options' => array( |
| 166 |
|
'type' => 'text', |
| 167 |
|
'not null' => TRUE), |
| 168 |
|
'original_author' => array( |
| 169 |
|
'type' => 'varchar', |
| 170 |
|
'length' => 100, |
| 171 |
|
'not null' => TRUE, |
| 172 |
|
'default' => '', |
| 173 |
|
), |
| 174 |
|
'original_comments' => array( |
| 175 |
|
'type' => 'varchar', |
| 176 |
|
'length' => 250, |
| 177 |
|
'not null' => TRUE, |
| 178 |
|
), |
| 179 |
|
'story_guid' => array( |
| 180 |
|
'type' => 'int', |
| 181 |
|
'size' => 'big', |
| 182 |
|
'unsigned' => TRUE, |
| 183 |
|
'not null' => TRUE, |
| 184 |
|
'default' => 0, |
| 185 |
|
), |
| 186 |
|
'fid' => array( |
| 187 |
|
'type' => 'int', |
| 188 |
|
'size' => 'normal', |
| 189 |
|
'unsigned' => TRUE, |
| 190 |
|
'not null' => TRUE, |
| 191 |
|
'default' => 0, |
| 192 |
|
), |
| 193 |
|
'image_id' => array( |
| 194 |
|
'type' => 'int', |
| 195 |
|
'size' => 'normal', |
| 196 |
|
'unsigned' => TRUE, |
| 197 |
|
'not null' => TRUE, |
| 198 |
|
'default' => 0, |
| 199 |
|
), |
| 200 |
|
'image_guid' => array( |
| 201 |
|
'type' => 'int', |
| 202 |
|
'size' => 'big', |
| 203 |
|
'unsigned' => TRUE, |
| 204 |
|
'not null' => TRUE, |
| 205 |
|
'default' => 0, |
| 206 |
|
), |
| 207 |
|
), |
| 208 |
|
'primary key' => array('nid'), |
| 209 |
|
'indexes' => array( |
| 210 |
|
'story_guid' => array('story_guid'), |
| 211 |
|
'image_id' => array('image_id'), |
| 212 |
|
'fid' => array('fid'), |
| 213 |
|
'image_guid' => array('image_guid'), |
| 214 |
|
), |
| 215 |
|
); |
| 216 |
|
return $schema; |
| 217 |
} |
} |
| 218 |
|
|
| 219 |
function aggregation_update_3() |
function aggregation_update_3() |
| 241 |
|
|
| 242 |
function aggregation_update_4() |
function aggregation_update_4() |
| 243 |
{ |
{ |
| 244 |
db_query("ALTER TABLE {aggregation_item} modify `story_guid` bigint"); |
$ret = array(); |
| 245 |
db_query("ALTER TABLE {aggregation_item} modify `image_guid` bigint"); |
|
| 246 |
|
db_change_field($ret, 'aggregation_item', 'story_guid', 'story_guid', array('type' => 'int', 'size' => 'big', 'not null' => TRUE, 'default' => 0)); |
| 247 |
|
db_change_field($ret, 'aggregation_item', 'image_guid', 'image_guid', array('type' => 'int', 'size' => 'big', 'not null' => TRUE, 'default' => 0)); |
| 248 |
|
|
| 249 |
$original_items = db_query("SELECT * FROM {aggregation_item}"); |
$original_items = db_query("SELECT * FROM {aggregation_item}"); |
| 250 |
|
|
| 256 |
$new_image_guid = sprintf('%u', $row->image_guid); |
$new_image_guid = sprintf('%u', $row->image_guid); |
| 257 |
|
|
| 258 |
if ($row->story_guid != $new_story_guid) |
if ($row->story_guid != $new_story_guid) |
| 259 |
$update_statement .= "`story_guid` = $new_story_guid"; |
$update_statement .= "story_guid = $new_story_guid"; |
| 260 |
|
|
| 261 |
if ($row->image_guid != $new_image_guid) |
if ($row->image_guid != $new_image_guid) |
| 262 |
if ($update_statement == '') |
if ($update_statement == '') |
| 263 |
$update_statement .= "`image_guid` = $new_image_guid"; |
$update_statement .= "image_guid = $new_image_guid"; |
| 264 |
else |
else |
| 265 |
$update_statement .= ",`image_guid` = $new_image_guid"; |
$update_statement .= ",image_guid = $new_image_guid"; |
| 266 |
|
|
| 267 |
if ($update_statement == '') continue; |
if ($update_statement == '') continue; |
| 268 |
|
|
| 269 |
db_query("UPDATE {aggregation_item} SET $update_statement WHERE nid = %d", $row->nid); |
db_query("UPDATE {aggregation_item} SET $update_statement WHERE nid = %d", $row->nid); |
| 270 |
} |
} |
| 271 |
|
|
| 272 |
db_query("ALTER TABLE {aggregation_item} modify `story_guid` int unsigned"); |
db_change_field($ret, 'aggregation_item', 'story_guid', 'story_guid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); |
| 273 |
db_query("ALTER TABLE {aggregation_item} modify `image_guid` int unsigned"); |
db_change_field($ret, 'aggregation_item', 'image_guid', 'image_guid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); |
| 274 |
|
|
| 275 |
return array(); |
return $ret; |
| 276 |
} |
} |
| 277 |
|
|
| 278 |
function aggregation_update_5() |
function aggregation_update_5() |
| 300 |
|
|
| 301 |
function aggregation_update_6() |
function aggregation_update_6() |
| 302 |
{ |
{ |
| 303 |
if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_feed') . "}'")) == 0) return; |
$ret = array(); |
| 304 |
if (db_num_rows(db_query("SHOW TABLES LIKE '{" . db_escape_table('aggregator2_item') . "}'")) == 0) return; |
|
| 305 |
|
if (!db_table_exists('aggregator2_feed')) return $ret; |
| 306 |
|
if (!db_table_exists('aggregator2_item')) return $ret; |
| 307 |
|
|
| 308 |
if (!ini_get('safe_mode')) |
if (!ini_get('safe_mode')) |
| 309 |
set_time_limit(30 * 60); |
set_time_limit(30 * 60); |
| 327 |
|
|
| 328 |
foreach ($taxonomies_old_style AS $key => $value) |
foreach ($taxonomies_old_style AS $key => $value) |
| 329 |
{ |
{ |
| 330 |
$vid = db_query("SELECT vid FROM {term_data} WHERE tid = %d", $value); |
$vid_result = db_query("SELECT vid FROM {term_data} WHERE tid = %d", $value); |
| 331 |
if (db_num_rows($vid) == 0) continue; |
$num_rows = FALSE; |
| 332 |
$vid = db_fetch_object($vid)->vid; |
$vid = -1; // simple initialization |
| 333 |
|
|
| 334 |
|
while ($vid_obj = db_fetch_object($vid_result)) |
| 335 |
|
{ |
| 336 |
|
$num_rows = TRUE; |
| 337 |
|
$vid = $vid_obj->vid; |
| 338 |
|
} |
| 339 |
|
if (!$num_rows) continue; |
| 340 |
$taxonomies_new_style[$vid][$value] = $value; |
$taxonomies_new_style[$vid][$value] = $value; |
| 341 |
} |
} |
| 342 |
|
|
| 343 |
$row->item_taxonomy = serialize($taxonomies_new_style); |
$row->item_taxonomy = serialize($taxonomies_new_style); |
| 344 |
|
|
| 345 |
db_query("INSERT INTO {aggregation_feed} VALUES ". |
db_query("INSERT INTO {aggregation_feed} (nid, original_author, url, username, password, refresh_interval, title_as_guid_interval, enabled, publish_new_items, aggregate_to_moderation_queue, sticky_items, enable_comments_on_articles, enable_comments_on_images, promote_to_frontpage, delete_old_items, link_items_to_original_urls, item_categories, etag, last_modified, last_refreshed) VALUES ". |
| 346 |
"(%d, '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d ,'%s', '%s', '%s', '%s', %d, %d)", |
"(%d, '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d ,'%s', '%s', '%s', '%s', %d, %d)", |
| 347 |
$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); |
$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); |
| 348 |
|
|
| 359 |
} |
} |
| 360 |
} |
} |
| 361 |
|
|
| 362 |
db_query("DROP TABLE {aggregator2_feed}"); |
db_drop_table($ret, 'aggregator2_feed'); |
| 363 |
db_query("DROP TABLE {aggregator2_item}"); |
db_drop_table($ret, 'aggregator2_item'); |
| 364 |
|
|
| 365 |
|
return $ret; |
| 366 |
} |
} |
| 367 |
|
|
| 368 |
//update function for 4.7 & 5 branch |
//update function for 4.7 & 5 branch |
| 369 |
function aggregation_update_7() |
function aggregation_update_7() |
| 370 |
{ |
{ |
| 371 |
$ret = array(); |
$ret = array(); |
| 372 |
|
|
| 373 |
switch ($GLOBALS['db_type']) |
db_change_field($ret, 'aggregation_feed', 'url', 'url', array('type' => 'varchar', 'length' => 250, 'not null' => TRUE)); |
| 374 |
{ |
db_change_field($ret, 'aggregation_item', 'url', 'url', array('type' => 'varchar', 'length' => 250, 'not null' => TRUE)); |
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} modify `url` varchar(250) NOT NULL"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} modify `url` varchar(250) NOT NULL"); |
|
|
break; |
|
|
} |
|
| 375 |
|
|
| 376 |
return $ret; |
return $ret; |
| 377 |
} |
} |
| 380 |
function aggregation_update_8() |
function aggregation_update_8() |
| 381 |
{ |
{ |
| 382 |
$ret = array(); |
$ret = array(); |
| 383 |
|
|
| 384 |
switch ($GLOBALS['db_type']) |
db_add_field($ret, 'aggregation_feed', 'aggregation_feed_options', array('type' => 'text', 'not null' => TRUE)); |
| 385 |
{ |
db_add_field($ret, 'aggregation_feed', 'time_to_live', array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0)); |
| 386 |
case 'mysql': |
db_add_field($ret, 'aggregation_item', 'aggregation_item_options', array('type' => 'text', 'not null' => TRUE)); |
| 387 |
case 'mysqli': |
db_add_field($ret, 'aggregation_item', 'original_comments', array('type' => 'varchar', 'length' => 250, 'not null' => TRUE)); |
| 388 |
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD aggregation_feed_options text NOT NULL AFTER item_categories"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} ADD time_to_live int(10) NOT NULL default 0 AFTER promote_to_frontpage"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD aggregation_item_options text NOT NULL AFTER link_to_original_url"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} ADD original_comments varchar(250) NOT NULL AFTER original_author"); |
|
|
break; |
|
|
} |
|
|
|
|
| 389 |
$old_feed_data = db_query("SELECT * FROM {aggregation_feed}"); |
$old_feed_data = db_query("SELECT * FROM {aggregation_feed}"); |
| 390 |
|
|
| 391 |
while ($row = db_fetch_object($old_feed_data)) |
while ($row = db_fetch_object($old_feed_data)) |
| 429 |
$options_array = serialize($options_array); |
$options_array = serialize($options_array); |
| 430 |
|
|
| 431 |
db_query("UPDATE {aggregation_item} SET aggregation_item_options = '%s' WHERE nid = %d", $options_array, $row->nid); |
db_query("UPDATE {aggregation_item} SET aggregation_item_options = '%s' WHERE nid = %d", $options_array, $row->nid); |
| 432 |
} |
} |
| 433 |
|
|
| 434 |
|
db_drop_field($ret, 'aggregation_feed', 'aggregate_to_moderation_queue'); |
| 435 |
|
db_drop_field($ret, 'aggregation_feed', 'enable_comments_on_articles'); |
| 436 |
|
db_drop_field($ret, 'aggregation_feed', 'enable_comments_on_images'); |
| 437 |
|
db_drop_field($ret, 'aggregation_feed', 'enabled'); |
| 438 |
|
db_drop_field($ret, 'aggregation_feed', 'link_items_to_original_urls'); |
| 439 |
|
db_drop_field($ret, 'aggregation_feed', 'publish_new_items'); |
| 440 |
|
db_drop_field($ret, 'aggregation_feed', 'sticky_items'); |
| 441 |
|
db_drop_field($ret, 'aggregation_feed', 'delete_old_items'); |
| 442 |
|
db_drop_field($ret, 'aggregation_item', 'link_to_original_url'); |
| 443 |
|
|
| 444 |
switch ($GLOBALS['db_type']) |
variable_del('aggregation_item_time_to_live'); |
|
{ |
|
|
case 'mysql': |
|
|
case 'mysqli': |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN aggregate_to_moderation_queue"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enable_comments_on_articles"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enable_comments_on_images"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN enabled"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN link_items_to_original_urls"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN publish_new_items"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN sticky_items"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_feed} DROP COLUMN delete_old_items"); |
|
|
$ret[] = update_sql("ALTER TABLE {aggregation_item} DROP COLUMN link_to_original_url"); |
|
|
break; |
|
|
} |
|
|
|
|
|
variable_del('aggregation_item_time_to_live'); |
|
| 445 |
|
|
| 446 |
return $ret; |
return $ret; |
| 447 |
} |
} |
| 448 |
|
|
| 449 |
function aggregation_uninstall() |
function aggregation_uninstall() |
| 464 |
if ($vocabulary_to_delete >= 0) |
if ($vocabulary_to_delete >= 0) |
| 465 |
taxonomy_del_vocabulary($vocabulary_to_delete); |
taxonomy_del_vocabulary($vocabulary_to_delete); |
| 466 |
|
|
| 467 |
db_query("DROP TABLE {aggregation_item}"); |
drupal_uninstall_schema('aggregation_item'); |
| 468 |
db_query("DROP TABLE {aggregation_feed}"); |
drupal_uninstall_schema('aggregation_feed'); |
| 469 |
|
|
| 470 |
variable_del('aggregation_current_vid'); |
variable_del('aggregation_current_vid'); |
| 471 |
variable_del('aggregation_item_time_to_live'); |
variable_del('aggregation_item_time_to_live'); |
| 472 |
variable_del('aggregation_enable_logging'); |
variable_del('aggregation_enable_logging'); |
| 489 |
// Ensure translations don't break at install time |
// Ensure translations don't break at install time |
| 490 |
$t = get_t(); |
$t = get_t(); |
| 491 |
|
|
|
// Test PHP version |
|
|
$requirements['PHP'] = array( |
|
|
'title' => $t('PHP'), |
|
|
'value' => ($phase == 'runtime') ? l(phpversion(), 'admin/logs/status/php') : |
|
|
phpversion(), |
|
|
); |
|
|
|
|
|
if (version_compare(phpversion(), '5.0.0') < 0) |
|
|
{ |
|
|
$requirements['PHP']['description'] = $t('This module requires at least PHP %version.', array('%version' => '5.0.0')); |
|
|
$requirements['PHP']['severity'] = REQUIREMENT_ERROR; |
|
|
} |
|
|
|
|
| 492 |
$requirements['CURL'] = array(); |
$requirements['CURL'] = array(); |
| 493 |
$requirements['CURL']['title'] = $t('CURL'); |
$requirements['CURL']['title'] = $t('CURL'); |
| 494 |
$requirements['CURL']['value'] = $t('INSTALLED'); |
$requirements['CURL']['value'] = $t('INSTALLED'); |
| 496 |
// Test for CURL support |
// Test for CURL support |
| 497 |
if (!function_exists('curl_init')) |
if (!function_exists('curl_init')) |
| 498 |
{ |
{ |
| 499 |
$requirements['CURL']['value'] = $t('NOT INSTALLED'); |
$requirements['CURL']['value'] = $t('NOT INSTALLED'); |
| 500 |
$requirements['CURL']['description'] = $t('CURL support not present.'); |
$requirements['CURL']['description'] = $t('CURL support not present.'); |
| 501 |
$requirements['CURL']['severity'] = REQUIREMENT_ERROR; |
$requirements['CURL']['severity'] = REQUIREMENT_ERROR; |
| 502 |
} |
} |
|
|
|
|
$requirements['DRUPAL'] = array(); |
|
|
$requirements['DRUPAL']['title'] = $t('Drupal'); |
|
|
$requirements['DRUPAL']['value'] = VERSION; |
|
|
|
|
|
// Test drupal version support |
|
|
if (strpos(VERSION, '5.') !== 0) |
|
|
{ |
|
|
$requirements['DRUPAL']['description'] = $t('Drupal version incompatible with this module.'); |
|
|
$requirements['DRUPAL']['severity'] = REQUIREMENT_ERROR; |
|
|
} |
|
| 503 |
|
|
| 504 |
return $requirements; |
return $requirements; |
| 505 |
} |
} |