Problem/Motivation
The module only purges when the file size is different. Per this line of code in purge_file.module, in the function purge_file_file_update().
&& ($file->getFileUri() != $original_file->getFileUri() || $file->getSize() != $original_file->getSize())) {
This is fine for 99.9% of use casese. However, a valid use case when updating a file may be to go in, and only change a few characters, that net the same filesize. Such as
Reviewed on: 01/30/2026
I might suggest we use something like the php function hash_file() here. If performance is a concern, maybe this can be run only when we determine that the filesize between the new and old versions are the same. I'm not sure if hash_file is efficient though, and I am concerned this could cause memory limit issues for larger files, so maybe there are better ways about it, like checking the mtime.
Alternatively, maybe we can make it a configuration option to just always send purges for any file update, and let the user decide if they need it or not.
Issue fork purge_file-3570620
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
Comment #5
omarlopesinoHi, many thanks for reporting it. I have applied a MR that tracks the hash of the files as you propose.
This hash is only managed for files which file size is lower or equal than a configured threshold. The default value is 1MB, but it can be increased. In this way we can avoid delays in page response / queue processing, assuming the heavy files will be mostly binaries and not documents.
It is ready in 1.0.x and it will be released soon (by the end of this week or the next one).
Comment #6
omarlopesino