Determine in file class if the file content is the same #14687
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I will need this one in 3.11.0 ideally.
Moved the detection whether the file is up to date to a new method
isFileContentSame()
. It looks unneeded, but is useful when you have eg aclass CdnFile {}
and need to update the content of that file not only on one path, but also for other trusted hosts. Then you need to save the content basically again if just one of the files is out of date. This happens only when using a custom directory for tracker files.eg /matomo/foo/$trustedHost/matomo.js
eg /matomo/foo/trusted.host.one/matomo.js
eg /matomo/foo/trusted.host.two/matomo.js
eg /matomo/foo/trusted.host.three/matomo.js
Then we don't just need to read/update/delete one file, but multiple times for each host.
For the same reason we need to return an array of which files were actually updated in the
save()
method. We might not just update the file in one path, but actually in multiple paths. And then we need to trigger an event for each updated file.Ideally we would have this logic better in core somehow, but the way we use it is quite special and usually you wouldn't have a file per trusted host.