You are here

function upload_filefield_paths_update in File (Field) Paths 5

Same name and namespace in other branches
  1. 6 modules/upload.inc \upload_filefield_paths_update()

Implementation of hook_filefield_paths_batch_update().

File

modules/upload.inc, line 71
Provides FileField Paths integration with the Upload module.

Code

function upload_filefield_paths_update($field_name, $type_name) {
  if (empty($field_name)) {
    $result = db_query("SELECT f.nid FROM {file_revisions} r LEFT JOIN {files} f ON r.fid = f.fid LEFT JOIN {node} n\n      ON f.nid = n.nid WHERE n.type = '%s'", $type_name);
    while ($data = db_fetch_object($result)) {
      $node = node_load($data->nid);

      // Set Form ID.
      $node->form_id = $node->type . '_node_form';

      // Process Node.
      filefield_paths_nodeapi($node, 'update', NULL, NULL);
    }
  }
}