Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Files stored in files/qr_codes are kept there forever. Implement some feature so that we can expire the cache.
Comment | File | Size | Author |
---|---|---|---|
#6 | qr_codes-empty-cache-3.patch | 4.66 KB | claudiu.cristea |
#5 | qr_codes-empty-cache-2.patch | 4.66 KB | claudiu.cristea |
#4 | qr_codes-empty-cache-1.patch | 4.63 KB | claudiu.cristea |
#3 | qr_codes-empty-cache.patch | 4.63 KB | claudiu.cristea |
Comments
Comment #1
levelos CreditAttribution: levelos commentedI'm thinking of a user generated "flush", much like imagecache handles it. I don't see too many situations where the generated images would change, unless you change providers, or the provider makes an upgrade to the API, and this could be handled with a manual user flush. Thoughts?
Comment #2
claudiu.cristeaI'm thinking on:
admin/settings/qr_codes
- For admin manual handlingadmin/settings/qr_codes
and hook_cron() implementation for cleaning old items.It should be enough...
Comment #3
claudiu.cristeaHere's a patch. It seems OK for me but I didn't test the hook_cron() behavior. On my system cron is disabled for some reasons. @loubab, can you test if cron purge the expired files correctly?
Comment #4
claudiu.cristeaTypo fix...
Comment #5
claudiu.cristeaDisable the "Cache clear now!" button when cache is empty.
Comment #6
claudiu.cristeaTypo fix
Comment #7
claudiu.cristeaComment #8
levelos CreditAttribution: levelos commentedCommitted with a few minor changes. Nice!
Comment #9
claudiu.cristeaLooking into the code, at your changes... It seems that the validation callback reject "0" (Never clear) cache lifetime. I used a select to limit choices and prevent errors which seems to me a better approach. I see that other modules use this too.
But, anyway if we want to use a textfield, we must ensure that "0" value is a valid value. Also we can use ctype_digit() instead of is_numeric() to test.
Comment #10
levelos CreditAttribution: levelos commentedI've tried on both an existing and a fresh install, and the validation seems to work fine with 0. Can you verify the problem you're having? I see your point on ctype_digit, and happy to change that.
In general, I think if we're allowing users to set the cache lifetime, no need to limit them to arbitrary choices via a select when the validation is so simple.
Comment #11
claudiu.cristeaFixed some minor issues:
Committed in #391142.