I want to add a system that checks the filesystem md5sum Vs the md5sum stored in the database. I run such a custom script on some Piwigo.com accounts and a few of them have tons of files with unexpected md5sums. Files are obviously not corrupted so where is the problem?
For now, I've found several occasions when the file is modified but the images.md5sum is not updated:
when Piwigo is configured to downsize photos after upload
when Write Metadata does its job
maybe (not tested yet) when Crop Images does its job
I have also found another way leading to this difference: when you upload a photos with pwg.images.add, the API client provides the original_sum, which can be anything, and Piwigo does not compare it to the actual md5sum of the registered file.
At first I thought "Let's update the images.md5sum column in the database on the listed cases". But I quickly came to another conclusion. Piwigo 15 uses the images.md5sum for one main reason: checks the existence of the photo. Has this photo already been uploaded? Is this photo a duplicate? If Piwigo updates the images.md5sum when a photo is resized after upload, if you re-upload the same photo it's going to be complicated to say "this photo has already been uploaded".
My conclusion is that we need to keep images.md5sum has it is, ie the "original md5sum" and add a new column images.md5sum_fs which is supposed to be the actual md5sum of the file stored in the filesystem. Of course, the 2 columns will/may differ over time.
Note: it can be relevant to update images.md5sum, for example when you "update" the file. Be it with API method pwg.images.upload or with plugin Photo Update.
I want to add a system that checks the filesystem md5sum Vs the md5sum stored in the database. I run such a custom script on some Piwigo.com accounts and a few of them have tons of files with unexpected md5sums. Files are obviously not corrupted so where is the problem?
For now, I've found several occasions when the file is modified but the `images.md5sum` is not updated:
- when Piwigo is configured to downsize photos after upload
- when Write Metadata does its job
- maybe (not tested yet) when Crop Images does its job
I have also found another way leading to this difference: when you upload a photos with `pwg.images.add`, the API client provides the `original_sum`, which can be anything, and Piwigo does not compare it to the actual md5sum of the registered file.
At first I thought "Let's update the `images.md5sum` column in the database on the listed cases". But I quickly came to another conclusion. Piwigo 15 uses the `images.md5sum` for one main reason: checks the existence of the photo. Has this photo already been uploaded? Is this photo a duplicate? If Piwigo updates the `images.md5sum` when a photo is resized after upload, if you re-upload the same photo it's going to be complicated to say "this photo has already been uploaded".
My conclusion is that we need to keep `images.md5sum` has it is, ie the "original md5sum" and add a new column `images.md5sum_fs` which is supposed to be the actual md5sum of the file stored in the filesystem. Of course, the 2 columns will/may differ over time.
Note: it can be relevant to update `images.md5sum`, for example when you "update" the file. Be it with API method `pwg.images.upload` or with plugin Photo Update.
<!-- github-sync-id:2848605336 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I want to add a system that checks the filesystem md5sum Vs the md5sum stored in the database. I run such a custom script on some Piwigo.com accounts and a few of them have tons of files with unexpected md5sums. Files are obviously not corrupted so where is the problem?
For now, I've found several occasions when the file is modified but the
images.md5sumis not updated:I have also found another way leading to this difference: when you upload a photos with
pwg.images.add, the API client provides theoriginal_sum, which can be anything, and Piwigo does not compare it to the actual md5sum of the registered file.At first I thought "Let's update the
images.md5sumcolumn in the database on the listed cases". But I quickly came to another conclusion. Piwigo 15 uses theimages.md5sumfor one main reason: checks the existence of the photo. Has this photo already been uploaded? Is this photo a duplicate? If Piwigo updates theimages.md5sumwhen a photo is resized after upload, if you re-upload the same photo it's going to be complicated to say "this photo has already been uploaded".My conclusion is that we need to keep
images.md5sumhas it is, ie the "original md5sum" and add a new columnimages.md5sum_fswhich is supposed to be the actual md5sum of the file stored in the filesystem. Of course, the 2 columns will/may differ over time.Note: it can be relevant to update
images.md5sum, for example when you "update" the file. Be it with API methodpwg.images.uploador with plugin Photo Update.