Skip to content

Commit

Permalink
Add tootctl accounts backup (#8811)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Sep 28, 2018
1 parent f0fff3e commit 38f5f9c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/mastodon/accounts_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,32 @@ def delete(username)
exit(1)
end

say("Deleting user with #{account.statuses_count}, this might take a while...")
say("Deleting user with #{account.statuses_count} statuses, this might take a while...")
SuspendAccountService.new.call(account, remove_user: true)
say('OK', :green)
end

desc 'backup USERNAME', 'Request a backup for a user'
long_desc <<-LONG_DESC
Request a new backup for an account with a given USERNAME.
The backup will be created in Sidekiq asynchronously, and
the user will receive an e-mail with a link to it once
it's done.
LONG_DESC
def backup(username)
account = Account.find_local(username)

if account.nil?
say('No user with such username', :red)
exit(1)
end

backup = account.user.backups.create!
BackupWorker.perform_async(backup.id)
say('OK', :green)
end

option :dry_run, type: :boolean
desc 'cull', 'Remove remote accounts that no longer exist'
long_desc <<-LONG_DESC
Expand Down

0 comments on commit 38f5f9c

Please sign in to comment.