scinote-web/lib/tasks/exportable_items.rake

10 lines
324 B
Ruby
Raw Normal View History

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