edwardspec / mediawiki-aws-s3

Extension:AWS allows MediaWiki to use Amazon S3 (instead of the local directory) to store images.
https://www.mediawiki.org/wiki/Extension:AWS
GNU General Public License v2.0
42 stars 32 forks source link

Automatically expire unused contents of the local cache #54

Closed davidhaslip closed 1 year ago

davidhaslip commented 1 year ago

Currently there isn't a good way to remove unused/unnecessary files from the local cache. I'm not sure if this is possible, but when a file exists in the cache and is accessed for some purpose can the "date" of the file be updated? Then perhaps files older then X months can be automatically deleted as unused, which would save space. If that's not possible, a way to automatically delete files after X months/years might be nice.

edwardspec commented 1 year ago

Since they are local files, and filesystem already tracks this (unless disabled with noatime), you can probably use a command like

find /path/to/images -atime +6

(list files not accessed for 7 days or more) to find the ones you want to delete.

davidhaslip commented 1 year ago

Thanks, I appreciate the help.