diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-08-26 16:53:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-26 16:53:06 +0200 |
commit | b378b4c5c7e99de2c14e39e2733a745689de8ad1 (patch) | |
tree | a393ed521b974921e1819cee3d40fd82a4cdf06d /lib/mastodon/media_cli.rb | |
parent | 5129f6f2aa56afb21708aec552a798d062ccaff9 (diff) |
Add CLI interface for importing custom emoji (#8437)
bin/tootctl emoji import PATH_TO_TAR Fix #8435
Diffstat (limited to 'lib/mastodon/media_cli.rb')
-rw-r--r-- | lib/mastodon/media_cli.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb index cc6ad07d9..00bd662f4 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/media_cli.rb @@ -2,6 +2,7 @@ require_relative '../../config/boot' require_relative '../../config/environment' +require_relative 'cli_helper' # rubocop:disable Rails/Output @@ -23,8 +24,9 @@ module Mastodon the underlying file storage. DESC def remove - time_ago = options[:days].days.ago - queued = 0 + time_ago = options[:days].days.ago + queued = 0 + processed = 0 MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).select(:id).reorder(nil).find_in_batches do |media_attachments| if options[:background] @@ -33,13 +35,19 @@ module Mastodon else media_attachments.each do |m| Maintenance::UncacheMediaWorker.new.perform(m) - print '.' + say('.', :green, false) + processed += 1 end end end - puts - puts "Scheduled the deletion of #{queued} media attachments" if options[:background] + say + + if options[:background] + say("Scheduled the deletion of #{queued} media attachments", :green) + else + say("Removed #{processed} media attachments", :green) + end end end end |