function feedapi_update_6107 in FeedAPI 6
Convert refresh_time values to new constants FEEDAPI_CRON_NEVER_REFRESH and FEEDAPI_CRON_ALWAYS_REFRESH.
File
- ./
feedapi.install, line 275 - Install file for FeedAPI module.
Code
function feedapi_update_6107() {
$ret = array();
// next_refresh_time can contain negative values now.
$spec = array(
'type' => 'int',
'unsigned' => FALSE,
'default' => 0,
'not null' => TRUE,
);
db_change_field($ret, 'feedapi', 'next_refresh_time', 'next_refresh_time', $spec);
// Update all node type settings.
$node_types = node_get_types('types');
foreach ($node_types as $node_type) {
if (feedapi_enabled_type($node_type)) {
if ($settings = feedapi_get_settings($node_type)) {
if ($settings['refresh_time'] == 0 || $settings['refresh_time'] == 1) {
$settings['refresh_time'] = $settings['refresh_time'] == 0 ? FEEDAPI_CRON_NEVER_REFRESH : FEEDAPI_CRON_ALWAYS_REFRESH;
_feedapi_store_settings(array(
'node_type' => $node_type,
), $settings);
}
}
}
}
// Update all node settings.
$result = db_query('SELECT n.type, f.vid FROM {node} n JOIN {feedapi} f ON f.nid = n.nid');
while ($node = db_fetch_object($result)) {
if ($settings = feedapi_get_settings($node->type, $node->vid)) {
if ($settings['refresh_time'] == 0 || $settings['refresh_time'] == 1) {
$settings['refresh_time'] = $settings['refresh_time'] == 0 ? FEEDAPI_CRON_NEVER_REFRESH : FEEDAPI_CRON_ALWAYS_REFRESH;
_feedapi_store_settings(array(
'node_type' => $node->type,
'vid' => $node->vid,
), $settings);
}
}
}
return $ret;
}