Add CLI interface for importing custom emoji (#8437)
bin/tootctl emoji import PATH_TO_TAR Fix #8435
This commit is contained in:
parent
5129f6f2aa
commit
b378b4c5c7
4 changed files with 106 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue