When "Retroactive update" on filefields in nodes with revisions, only the last revision gets updated.

This happens because even if in filefield_filefield_paths_batch_update() retrieves the correct list with nodes, in filefield_paths_batch_update() the list is flatten using array_unique().

Possible solution

Retrieve also vid in object list:

function filefield_filefield_paths_batch_update($field, $type, &$objects) {
  $field = content_fields($field, $type);
  $db_info = content_database_info($field);

  $result = db_query(
    "SELECT c.nid, c.vid 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'], $type
  );

  // Build array of Node IDs.
  while ($node = db_fetch_object($result)) {
    $objects[] = $node->nid . ':' . $node->vid;
  }
}

and...

function filefield_filefield_paths_update($oid, $field) {
  list($nid, $vid) = explode(':', $oid);
  $node = node_load($nid, $vid);
  $content_type = content_types($node->type);

...

Comments

Simon Georges’s picture

Deciphered’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

No longer supporting Drupal 6 issues for this module.

joshuasosa’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Closed (won't fix) » Active

This issue is still relevant in the Drupal 7 version. In my case, using the retroactive update, files in revisions are not moved. Only the latest version is moved.