mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Revert "FIX: under concurrent usage booting rails could cause plugin corruption"
This reverts commit c457d3bf28
.
Something is not right about this fix, reverting.
This commit is contained in:
parent
0054ccc522
commit
9cbed7ee46
@ -543,17 +543,9 @@ class Plugin::Instance
|
||||
|
||||
Discourse::Utils.execute_command('mkdir', '-p', target)
|
||||
target << name.gsub(/\s/, "_")
|
||||
|
||||
symlink_is_correct = false
|
||||
begin
|
||||
symlink_is_correct = File.exists?(target) && File.readlink(target) == public_data
|
||||
rescue Errno::EINVAL, Errno::ENOENT
|
||||
end
|
||||
|
||||
if !symlink_is_correct
|
||||
Discourse::Utils.execute_command('rm', '-f', target)
|
||||
Discourse::Utils.execute_command('ln', '-s', public_data, target)
|
||||
end
|
||||
# TODO a cleaner way of registering and unregistering
|
||||
Discourse::Utils.execute_command('rm', '-f', target)
|
||||
Discourse::Utils.execute_command('ln', '-s', public_data, target)
|
||||
end
|
||||
|
||||
ensure_directory(Plugin::Instance.js_path)
|
||||
@ -566,22 +558,12 @@ class Plugin::Instance
|
||||
contents << (is_dir ? "depend_on('#{f}')" : "require_asset('#{f}')")
|
||||
end
|
||||
|
||||
File.delete(js_file_path) if js_asset_exists?
|
||||
|
||||
if contents.present?
|
||||
contents.insert(0, "<%")
|
||||
contents << "%>"
|
||||
|
||||
contents = contents.join("\n")
|
||||
|
||||
if File.exists?(js_file_path)
|
||||
current_contents = File.read(js_file_path)
|
||||
if current_contents != contents
|
||||
File.write(js_file_path, conten)
|
||||
end
|
||||
else
|
||||
write_asset(js_file_path, contents)
|
||||
end
|
||||
else
|
||||
File.delete(js_file_path) if js_asset_exists?
|
||||
write_asset(js_file_path, contents.join("\n"))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user