mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
adds expired days in constant
This commit is contained in:
parent
e1ee53eeb5
commit
e016bda9d2
|
@ -223,6 +223,8 @@ class Constants
|
|||
href src width height alt cite datetime title class name xml:lang abbr style
|
||||
).freeze
|
||||
|
||||
EXPORTABLE_ZIP_EXPIRATION_DAYS = 7
|
||||
|
||||
# Very basic regex to check for validity of emails
|
||||
BASIC_EMAIL_REGEX = URI::MailTo::EMAIL_REGEXP
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
namespace :exportable_items do
|
||||
desc 'Removes exportable zip files if older than 7 days'
|
||||
desc 'Removes exportable zip files'
|
||||
task cleanup: :environment do
|
||||
ZipExport.where('created_at < ?', 7.days.ago).destroy_all
|
||||
puts "All exportable zip files older than '#{7.days.ago}' have been removed"
|
||||
num = Constants::EXPORTABLE_ZIP_EXPIRATION_DAYS
|
||||
ZipExport.where('created_at < ?', num.days.ago).destroy_all
|
||||
puts "All exportable zip files older than " \
|
||||
"'#{num.days.ago}' have been removed"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue