From 5cc716688abdf7eaafc58d804209510601190791 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 26 Feb 2018 01:31:44 +0100 Subject: Ensure the app does not even start if OTP_SECRET is not set (#6557) * Ensure the app does not even start if OTP_SECRET is not set * Remove PAPERCLIP_SECRET (it's not used by anything, actually) Imports are for internal consumption and the url option isn't even used correctly, so we can remove the hash stuff from them --- lib/tasks/mastodon.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/tasks/mastodon.rake') diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index d2e4f38a9..bf4c53cb3 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -23,7 +23,7 @@ namespace :mastodon do prompt.say('Single user mode disables registrations and redirects the landing page to your public profile.') env['SINGLE_USER_MODE'] = prompt.yes?('Do you want to enable single user mode?', default: false) - %w(SECRET_KEY_BASE PAPERCLIP_SECRET OTP_SECRET).each do |key| + %w(SECRET_KEY_BASE OTP_SECRET).each do |key| env[key] = SecureRandom.hex(64) end -- cgit From 76198c63b613f353f2e4a82ce89a8450ca219b88 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Mon, 26 Feb 2018 16:01:49 -0500 Subject: Some images can cause `convert` to fail, which crashes this whole task (#6565) * Some images can cause `convert` to fail, which crashes this whole task * Add more specific exception --- lib/tasks/mastodon.rake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/tasks/mastodon.rake') diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index bf4c53cb3..a06e35226 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -494,9 +494,13 @@ namespace :mastodon do accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present? accounts.find_each do |account| - account.reset_avatar! - account.reset_header! - account.save + begin + account.reset_avatar! + account.reset_header! + account.save + rescue Paperclip::Error + puts "Error resetting avatar and header for account #{username}@#{domain}" + end end end end -- cgit From ecd36c1ede5df0204d467eb7413d51afaaba5120 Mon Sep 17 00:00:00 2001 From: Thomas Leister Date: Thu, 1 Mar 2018 23:30:06 +0100 Subject: Fixes #6584 (#6585) --- lib/tasks/mastodon.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/tasks/mastodon.rake') diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index a06e35226..9202b4839 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -476,8 +476,10 @@ namespace :mastodon do time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media| - media.file.destroy - media.save + if media.file.exists? + media.file.destroy + media.save + end end end -- cgit