Follow-up from #1057656: Image styles don't flush for images stored non-default schemes.
Updated: Comment #0
Problem/Motivation
When editing image styles, the watchdog gets crowded with messages like
The file private://styles/bingo_bongo was not deleted because it does not exist.
This is due to the fact that upon image style flushing, file_unmanaged_delete_recursive()
logs a message if the file to be deleted is non-existent, which is quite the case (for the non-default wrappers) when you are making changes to the style, editing its effects. While this is an expected behavior during a recursive delete, it seems to me unnecessary when it is the root file to be deleted.
Proposed resolution
Introduce a file existence check before invoking file_unmanaged_delete_recursive()
.
Remaining tasks
Approve patch.
User interface changes
None.
API changes
None.
Related Issues
None.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2079315-image_style_flush-10.patch | 688 bytes | mondrake |
#3 | 2079315-image_style_flush-3.patch | 825 bytes | mondrake |
#3 | interdiff_1-3.txt | 836 bytes | mondrake |
#1 | 2079315-image_style_flush-1.patch | 839 bytes | mondrake |
Comments
Comment #1
mondrakeComment #1.0
mondrakemore info
Comment #2
claudiu.cristeaUse a variable as you process twice the same file uri.
Otherwise looks good.
Comment #3
mondrakeSure. Thanks!
Comment #4
claudiu.cristeaJust one more comment: what is the reason for using
file_exists()
and notis_dir()
? I didn't have any clue what would be the best.Comment #5
mondrakeValid question. See #1057656: Image styles don't flush for images stored non-default schemes, comment #19.
We might end up having an unintended file with exactly the file name we are expecting to be a directory. So we just remove that in that case, or else the derivatives won't be generated.
Comment #6
claudiu.cristeaGreat catch!
Comment #7
claudiu.cristeaREMOVED! (erroneously duplicated last comment).
Comment #8
alexpottCommitted 00f461a and pushed to 8.x. Thanks!
Comment #9
mondrakeComment #10
mondrakePatch for Drupal 7.
Comment #11
claudiu.cristeaTests passed in D7 and I see no difference in the code comparing to D8. RTBC. Thank you.
Comment #11.0
claudiu.cristeac
Comment #12
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/a5a14f9