diff --git a/app/logical/remote_server.rb b/app/logical/remote_server.rb deleted file mode 100644 index 263095140..000000000 --- a/app/logical/remote_server.rb +++ /dev/null @@ -1,35 +0,0 @@ -class RemoteServer - attr_accessor :hostname - - def self.other_servers - Danbooru.config.other_server_hosts.map {|x| new(x)} - end - - def self.copy_to_all(local_path, remote_path) - other_servers.each do |server| - server.copy(local_path, remote_path) - end - end - - def self.delete_from_all(remote_path) - other_servers.each do |server| - server.delete(remote_path) - end - end - - def initialize(hostname) - @hostname = hostname - end - - def copy(local_path, remote_path) - Net::SFTP.start(hostname, Danbooru.config.remote_server_login) do |ftp| - ftp.upload!(local_path, remote_path) - end - end - - def delete(remote_path) - Net::SFTP.start(hostname, Danbooru.config.remote_server_login) do |ftp| - ftp.remove(remote_path) - end - end -end diff --git a/app/models/advertisement.rb b/app/models/advertisement.rb index ed6f0cb0a..3a1af7428 100644 --- a/app/models/advertisement.rb +++ b/app/models/advertisement.rb @@ -5,11 +5,11 @@ class Advertisement < ActiveRecord::Base after_destroy :delete_from_servers def copy_to_servers - RemoteServer.copy_to_all(image_path, image_path) + RemoteFileManager.new(image_path).distribute end def delete_from_servers - RemoteServer.delete_from_all(image_path) + RemoteFileManager.new(image_path).delete end def hit!(ip_addr)