Re-hash library job to detect files replaced with a preserved mtime
Author: derneuereCreated Sep 16, 2026Updated Sep 16, 2026
Labelsenhancementbackend
Summary
Add a "re-hash library" maintenance job that recomputes the content hash of every indexed file, so files replaced in place without a change in modification time are picked up. Split out of #730 (last checkbox), after #2039.
Why
#2039 makes the scanner re-index a replaced file when it is queued, which happens when the file's mtime moved. Tools that preserve timestamps (cp -p, rsync --times, some sync clients) replace the content while keeping the old mtime, so the incremental scan never looks at the file again and the stale hash and thumbnail stay forever.
Proposed change
- A
LongRunningJob(settings page button plus a management command) that walks everyFilerow, recomputes the hash, and callsreindex_replaced_filefromapps/backend/api/directory_watcher/file_handlers.pywhen it differs. - Progress and error counts reported through the existing job result fields, so partial failures show in the jobs list.
- Optionally scoped to one user or one subdirectory to keep it usable on large libraries.
Source: LibrePhotos/librephotos