add multisite support for the 'uploads:gather' rake task

This commit is contained in:
Régis Hanol 2016-04-12 16:00:25 +02:00
parent eda6084d4b
commit 8e4113a468
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,14 @@ require "digest/sha1"
task "uploads:gather" => :environment do
require "db_helper"
ENV["RAILS_DB"] ? gather_uploads : gather_uploads_for_all_sites
end
def gather_uploads_for_all_sites
RailsMultisite::ConnectionManagement.each_connection { gather_uploads }
end
def gather_uploads
public_directory = "#{Rails.root}/public"
current_db = RailsMultisite::ConnectionManagement.current_db