Skip to content

Provide a way to keep the original timestamp when using file_save(), use it in file classification batch #7173

Description

@indigoxela

Description of the need

This started as a conversation on Zulip.

When upgrading from D7 the File entity type has to get determined, which happens in function file_type_determine().
That simply uses file_save(), which does a lot more and among other things it sets the type. And it updates the timestamp.

File entities only have one timestamp property, which gets set to REQUEST_TIME in FileStorageController::preSave().
It always gets set, so there's no way to keep the timestamp, even if just updating some metadata, not the file itself.

This leads to the situation, that after upgrading from Drupal or whenever doing some batch logic with File entities, they get the REQUEST_TIME set. And after that it's no longer possible to sort files by (their actual) age - that's the bug part here.

Proposed solution

A new property to prevent updating the timestamp if requested.

Alternatives that have been considered

Hackish stuff to fix the all-files-same-age situation by scripting.

Additional information

Nothing so far...

Draft of feature description for Press Release (1 paragraph at most)

Backdrop now provides a way to keep the original timestamp of File entities when saving.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions