mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 11:52:45 +08:00
FEATURE: support multisite configuration for search:reindex task
This commit is contained in:
parent
1302db2683
commit
20c9c60dea
|
@ -1,6 +1,9 @@
|
|||
task "search:reindex" => :environment do
|
||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||
puts "Reindexing #{db}"
|
||||
ENV['RAILS_DB'] ? reindex_search : reindex_search_all_sites
|
||||
end
|
||||
|
||||
def reindex_search(db=RailsMultisite::ConnectionManagement.current_db)
|
||||
puts "Reindexing '#{db}'"
|
||||
puts ""
|
||||
puts "Posts:"
|
||||
Post.exec_sql("select p.id, p.cooked, c.name category, t.title, p.post_number, t.id topic_id from
|
||||
|
@ -43,4 +46,9 @@ task "search:reindex" => :environment do
|
|||
|
||||
puts
|
||||
end
|
||||
|
||||
def reindex_search_all_sites
|
||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||
reindex_search(db)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user