DEV: Multisite support for `rake posts:inline_uploads`.

DEV: Multisite support for rake posts:inline_uploads.

diff --git a/lib/tasks/posts.rake b/lib/tasks/posts.rake
index 69a1d89..138791d 100644
--- a/lib/tasks/posts.rake
+++ b/lib/tasks/posts.rake
@@ -660,6 +660,18 @@ end
 
 desc "Coverts full upload URLs in `Post#raw` to short upload url"
 task 'posts:inline_uploads' => :environment do |_, args|
+  if ENV['RAILS_DB']
+    correct_inline_uploads
+  else
+    RailsMultisite::ConnectionManagement.each_connection do |db|
+      puts "Correcting #{db}..."
+      puts
+      correct_inline_uploads
+    end
+  end
+end
+
+def correct_inline_uploads
   dry_run = (ENV["DRY_RUN"].nil? ? true : ENV["DRY_RUN"] != "false")
   verbose = ENV["VERBOSE"]

GitHub sha: 9bce3d5e

3 Likes