scinote-web/lib/tasks/exportable_items.rake

12 lines
355 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-03-27 16:02:47 +08:00
namespace :exportable_items do
2017-04-04 16:16:54 +08:00
desc 'Removes exportable zip files'
2017-03-27 16:02:47 +08:00
task cleanup: :environment do
2017-04-04 16:16:54 +08:00
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"
2017-03-27 16:02:47 +08:00
end
end