function feedapi_update_3 in FeedAPI 5
File
- ./
feedapi.install, line 132
Code
function feedapi_update_3() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$result = db_query('SELECT n.nid, n.type, f.items_delete, f.update_existing FROM {feedapi} f JOIN {node} n ON n.nid = f.nid');
while ($feed = db_fetch_object($result)) {
if ($settings = _feedapi_get_settings(array(
'node_type' => $feed->type,
'nid' => $feed->nid,
))) {
if (!isset($settings['refresh_on_create'])) {
$settings['refresh_on_create'] = 0;
}
if (isset($settings['feedapi_update_existing'])) {
$settings['update_existing'] = $settings['feedapi_update_existing'];
}
else {
$settings['update_existing'] = $feed->update_existing;
}
if (isset($settings['feedapi_items_delete'])) {
$settings['items_delete'] = $settings['feedapi_items_delete'];
}
else {
$settings['items_delete'] = $feed->items_delete;
}
_feedapi_store_settings(array(
'nid' => $feed->nid,
), $settings);
}
}
$ret[] = update_sql("ALTER TABLE {feedapi} DROP COLUMN items_delete");
$ret[] = update_sql("ALTER TABLE {feedapi} DROP COLUMN update_existing");
break;
case 'pgsql':
$result = db_query('SELECT n.nid, n.type, f.items_delete, f.update_existing FROM {feedapi} f JOIN {node} n ON n.nid = f.nid');
while ($feed = db_fetch_object($result)) {
if ($settings = _feedapi_get_settings(array(
'node_type' => $feed->type,
'nid' => $feed->nid,
))) {
if (!isset($settings['refresh_on_create'])) {
$settings['refresh_on_create'] = 0;
}
if (isset($settings['feedapi_update_existing'])) {
$settings['update_existing'] = $settings['feedapi_update_existing'];
}
else {
$settings['update_existing'] = $feed->update_existing;
}
if (isset($settings['feedapi_items_delete'])) {
$settings['items_delete'] = $settings['feedapi_items_delete'];
}
else {
$settings['items_delete'] = $feed->items_delete;
}
_feedapi_store_settings(array(
'nid' => $feed->nid,
), $settings);
}
}
$ret[] = update_sql("ALTER TABLE {feedapi} DROP COLUMN items_delete");
$ret[] = update_sql("ALTER TABLE {feedapi} DROP COLUMN update_existing");
break;
}
return $ret;
}