mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: Make recover from tombstone script work for multisite.
This commit is contained in:
parent
333d6f9f10
commit
b5d6d3c326
@ -406,9 +406,10 @@ def recover_from_tombstone
|
||||
begin
|
||||
original_setting = SiteSetting.max_image_size_kb
|
||||
SiteSetting.max_image_size_kb = 10240
|
||||
current_db = RailsMultisite::ConnectionManagement.current_db
|
||||
|
||||
public_path = Rails.root.join("public")
|
||||
paths = Dir.glob("#{File.join(public_path, 'uploads', 'tombstone', '**', '*.*')}")
|
||||
paths = Dir.glob(File.join(public_path, 'uploads', 'tombstone', current_db, '**', '*.*'))
|
||||
max = paths.length
|
||||
|
||||
paths.each_with_index do |path, index|
|
||||
@ -427,7 +428,7 @@ def recover_from_tombstone
|
||||
upload = Upload.find_by(url: url)
|
||||
|
||||
if !upload && url
|
||||
printf "Restoring #{url}..."
|
||||
printf "Restoring #{path}..."
|
||||
tombstone_path = File.join(public_path, 'uploads', 'tombstone', url.gsub(/^\/uploads\//, ""))
|
||||
|
||||
if File.exists?(tombstone_path)
|
||||
|
Loading…
Reference in New Issue
Block a user