function customfilter_update_6207 in Custom filter 6.2
Implements hook_update_N().
File
- ./
customfilter.install, line 295 - Installation file for Custom filter.
Code
function customfilter_update_6207(&$sandbox) {
$ret = array();
if (!isset($sandbox['progress'])) {
$sandbox['progress'] = 0;
$sandbox['max'] = db_result(db_query("SELECT COUNT(*) FROM {customfilter_filter}"));
$sandbox['current_fid'] = 0;
}
if ($sandbox['max']) {
$result = db_query_range("SELECT * FROM {customfilter_filter} WHERE fid > %d ORDER BY fid ASC", $sandbox['current_fid'], 0, 10);
while ($row = db_fetch_object($result)) {
drupal_write_record('customfilter_description', $row, 'fdid');
$sandbox['current_fid'] = $row->fid;
$sandbox['progress']++;
}
}
$ret['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max'];
if ($ret['#finished'] == 1) {
db_drop_field($ret, 'customfilter_filter', 'name');
db_drop_field($ret, 'customfilter_filter', 'description');
db_drop_field($ret, 'customfilter_filter', 'longtip');
db_drop_field($ret, 'customfilter_filter', 'shorttip');
$ret[] = array(
'success' => TRUE,
'query' => 'The filter descriptions have been moved to a different database table; the found values are used by default when there is not a description for the language enabled from Drupal',
);
}
return $ret;
}