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.
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.
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;
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);
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.