Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] File expiration #30

Open
TyroneSama opened this issue Apr 11, 2017 · 11 comments
Open

[FEATURE REQUEST] File expiration #30

TyroneSama opened this issue Apr 11, 2017 · 11 comments
Labels
feature Things that would be nice to have help wanted Help would be appreciated

Comments

@TyroneSama
Copy link

It would be nice to be able to configure automatic file deletion, to use lolisafe as a temporary uploader or save on disk space.

The usual way of doing it is "delete after X days", but it could also be useful to have files delete themselves after X days of not being accessed, so that frequently accessed files aren't suddenly pulled down.

@Pitu
Copy link
Member

Pitu commented Apr 12, 2017

I'm not sure I'm fond of the idea. I can see it being useful in the scenario you depicted, but it would take a revamp of the frontend prompting the user if the files should expire or not. I'll think about it and let you know in a few days.

Thanks for the suggestion!

@jithatsonei
Copy link

it would benefit safe.moe extremely

@Pitu
Copy link
Member

Pitu commented Apr 12, 2017

who dat

@TyroneSama
Copy link
Author

I wasn't really thinking of a per-file option, actually, though that could be useful. I'd personally get more use out of a global setting that applies to all uploads, which at least saves you the trouble of the UI redesign.

@giantcow
Copy link
Contributor

giantcow commented Mar 26, 2018

You can just set this up as a cron on the server itself:

@daily /usr/bin/find /full/path/to/lolisafe/uploads -type f -atime +30 -delete

This will delete all files that have not been accessed in over 30 days, not including those that are exactly 30 days.

Edit: Just realized that this would also delete thumbnail images if you don't go into the thumbnail view... would not recommend doing this ^^;

@noirscape
Copy link

@RyoshiKayo That wouldn't clean the database references to those files.

While it would solve the immediate issue of storage space, it is a hamfisted method.

@jithatsonei
Copy link

yeah you'd need a check script rather then trying to tie it all into one cronjob, sql will be needed to drop the data also

isnt too hard to do tbh

@Pitu Pitu added feature Things that would be nice to have help wanted Help would be appreciated and removed enhancement labels Jan 5, 2021
@Pitu
Copy link
Member

Pitu commented Jan 5, 2021

This should also apply to album links

@CyberiumShadow
Copy link

CyberiumShadow commented Mar 20, 2021

BobbyWibowo's fork has Cloudflare purge and file expiry cleanup implemented but the fork is still on V3 so I'm not sure how well it'd be able to translate to V4

Lack of this functionality is a major blocker for my own image host to migrate to V4

https://github.com/BobbyWibowo/lolisafe/blob/safe.fiery.me/controllers/utilsController.js#L513
https://github.com/BobbyWibowo/lolisafe/blob/safe.fiery.me/controllers/utilsController.js#L622
https://github.com/BobbyWibowo/lolisafe/blob/safe.fiery.me/controllers/utilsController.js#L413

and some relevant scripts
https://github.com/BobbyWibowo/lolisafe/tree/safe.fiery.me/scripts

@Pitu
Copy link
Member

Pitu commented Mar 22, 2021

Definitely something to look forward to, that's super useful

@test137E29B
Copy link
Contributor

test137E29B commented Nov 3, 2021

Added File Expiry with #307

Design decisions will need to be made though between:

  • Potentially leaving files behind OR
  • Much Higher Database operations OR
  • Potential files not existing for the duration of a delete when requested by a client

Have to choose which of these is the lesser evil. For most people I imagine higher db ops is fine, as it's only them or a few people using it, but for a larger host with constant file uploads / short expiry times, it would put a fair amount of load on the db.

IMO option 2 with db ops being higher is the way to go, but it's inefficient. Open to other opinions.

Can be very much extended with cache purge support, parse duration support for non "day" lengths etc. But this is a good starting point at least :)

@Pitu Pitu changed the title File expiration [FEATURE REQUEST] File expiration Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Things that would be nice to have help wanted Help would be appreciated
Projects
None yet
Development

No branches or pull requests

8 participants