Retroactive update doesn't update old revisions of nodes

Created on 4 April 2011, about 14 years ago
Updated 10 April 2025, 15 days ago

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);

...

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇷🇴Romania claudiu.cristea Arad 🇷🇴

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024