Skip to content

v6.6: feat(files): Archive files to an archive directory in a background job

Choose a tag to compare

@thorewi thorewi released this 30 Oct 13:53
· 2 commits to master since this release
Archiver::archive() publishes a background-queue job, processArchive()
moves the file: copy into a temporary file in the archive, checked
fsync(), size and hash verified against the row, rename, isArchived set,
local copy deleted only after the commit. Any failure throws and the job
is retried; running it again is safe and finishes an interrupted delete.

The archive is meant to be a soft NFS mount, where a write that only
reached the client cache is lost on an outage while fwrite()/fclose()
may report success - only a checked fsync() says the data is on the
server.

New column isArchived (is_archived, not null, default 0) - projects need
a migration. FileListener takes an optional archiveDir; archived files
get their path from it, getUrl() of an archived file throws.
adt/background-queue is suggested (required for dev/tests).