Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Simon Georges CreditAttribution: Simon Georges commentedClosed #1127456: Retroactive updates doesn't move old revision's files as a duplicate of this one.
Comment #2
Deciphered CreditAttribution: Deciphered commentedNo longer supporting Drupal 6 issues for this module.
Comment #3
joshuasosa CreditAttribution: joshuasosa commentedThis 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.