function _filefield_paths_include_updater_widget_settings_alter in File (Field) Paths 6.2
Implements hook_widget_settings_alter().
File
- includes/
updater.inc, line 37
Code
function _filefield_paths_include_updater_widget_settings_alter(&$settings, $op, $widget) {
if (_filefield_paths_module_supported($widget['module']) && $op == 'save' && in_array($widget['updater'], array(
'retroactive',
))) {
$nodes = array();
$field = content_fields($widget['field_name'], $widget['type_name']);
$db_info = content_database_info($field);
$result = db_query("SELECT c.nid FROM {%s} c LEFT JOIN {node} n ON c.nid = n.nid WHERE c.%s IS NOT NULL AND n.type = '%s'", $db_info['table'], $db_info['columns']['fid']['column'], $widget['type_name']);
// Build array of Node IDs.
while ($node = db_fetch_object($result)) {
$nodes[] = $node->nid;
}
// Create batch.
$batch = array(
'title' => t('Updating FileField Paths'),
'operations' => array(
array(
'_filefield_paths_updater_process',
array(
$nodes,
$field,
),
),
),
);
batch_set($batch);
}
}