Global link expiration Question

Hello, i have searched for quite some time and did not find a definitive answer to my question.

Does the Seafile server have an option where you can FORCE download link expiration’s to be ex… 30 days old, i know that the users can specify a timeout which is nice, but i am looking for a hard-coded option.

Thanks!

2 Likes

I second that. For abuse reaaons it would be nice if it was possible to define an overall maximum expiration date globally. e.g. 365 days or something.

1 Like

There is non-system way.

You can setup CRON job with script which connect to DATABASE, grab all NULL expiration date from share tables and by ctime(create time) setup expiration date.

Let job run every day.

UPDATE  `share_fileshare`       SET `expire_date` = DATE_ADD(`ctime`, INTERVAL 1 YEAR)  WHERE `expire_date` IS NULL;
UPDATE  `share_uploadlinkshare` SET `expire_date` = DATE_ADD(`ctime`, INTERVAL 1 YEAR)  WHERE `expire_date` IS NULL;
2 Likes

Awesome, will try that. Did you test this yourself?

Yes, but only for download (tables are same so it should work same).

You have to keep in mind that column expire_date is datetime not date but seafile don’t care about time. So link is not expired till date 23:59.

Here is cleaning query which delete all links expired year ago.

All queries I tried but keep in mind you’re running them on your own.

DELETE FROM `share_fileshare`       WHERE `expire_date` < DATE_SUB(NOW(),INTERVAL 1 YEAR);
DELETE FROM `share_uploadlinkshare` WHERE `expire_date` < DATE_SUB(NOW(),INTERVAL 1 YEAR);
4 Likes

I’m not sure why i never received a notification on this, but running a query is not the end of the world, thank you very much for this information!

Note that if you want to enforce it you just want to set it to 30 days for all links with another expiration time instead of only for links where it isn’t set.