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().

Steps to reproduce:
1) Create a file field on a node type, set to public://
2) Attach two fields to the node and save
3) Create a new revision and delete one of the flies, so that the first revision has both, the second only has one.
4) Change the field to private://, check the retroactive update box, and save the field settings
5) Observe in the file_managed table of the database that the file entity that is still attached to the current revision has been converted to private://, however the file entity only attached attached to the first revision, deleted from the second revision, is still public://.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

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.

j_s’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.

jaypan’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

This issue is still present in version 8.x.

jaypan’s picture

Issue summary: View changes
jaypan’s picture

Issue summary: View changes

Removing D7 example, as architecture has changed.

jaypan’s picture

Assigned: Unassigned » jaypan

jaypan’s picture

Assigned: jaypan » Unassigned
jaypan’s picture

Here's a patch for 8.x-1.x for a stopgap, as the merge request is for the -dev branch.

jaypan’s picture

Status: Active » Needs review

Moving to needs review.

liam morland’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll