This commit is contained in:
chiu 2021-02-18 10:09:31 +08:00
parent ad3118ec45
commit 197d34a19b
2 changed files with 11 additions and 11 deletions

View File

@ -37,7 +37,7 @@ class Admin::SitePanelController < OrbitAdminController
redirect_to admin_site_panel_server_manager_path
elsif params[:type] == 'detect_sites'
Thread.new do
system("rake create_site:detect_sites")
system("bundle exec rake create_site:detect_sites")
end
render :json => {"success"=>true}
elsif params[:type] == 'see_infos'
@ -85,11 +85,11 @@ class Admin::SitePanelController < OrbitAdminController
site_construct_id = site_construct.id.to_s
if params[:site_construct][:copy_id].blank?
Thread.new do
system("rake create_site:create_site['#{git_template_url}','#{git_extension_url}','#{git_url}','#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}']")
system("bundle exec rake create_site:create_site['#{git_template_url}','#{git_extension_url}','#{git_url}','#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}']")
end
else
Thread.new do
system("rake create_site:copy_site['#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}','#{params[:site_construct][:copy_id]}']")
system("bundle exec rake create_site:copy_site['#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}','#{params[:site_construct][:copy_id]}']")
end
end
redirect_to "#{admin_site_panel_sites_list_path}?id=#{site_construct_id}"
@ -111,28 +111,28 @@ class Admin::SitePanelController < OrbitAdminController
path = site_construct.path
site_construct_id = params[:id]
Thread.new do
system("rake create_site:create_site['#{git_template_url}','#{git_extension_url}','#{git_url}','#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}']")
system("bundle exec rake create_site:create_site['#{git_template_url}','#{git_extension_url}','#{git_url}','#{ip}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}']")
end
render :json =>{"success"=>true}
end
def edit_site
if params[:type] == 'delete'
Thread.new do
system("rake create_site:delete_site[#{params[:id]}]")
system("bundle exec rake create_site:delete_site[#{params[:id]}]")
end
elsif params[:type] == 'close'
Thread.new do
system("rake exec_commands:exec_commands[#{params[:id]},,close_site]")
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},,close_site]")
end
elsif params[:type] == 'open'
Thread.new do
system("rake exec_commands:exec_commands[#{params[:id]},,open_site]")
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},,open_site]")
end
elsif params[:type] == 'detail'
@site = SiteConstruct.find(params[:id])
render 'see_detail_for_created_site' and return
elsif params[:type] == 'change_server_name'
cmd = "rake create_site:change_site_server_name[#{params[:id]},'#{params[:site_construct][:domain_name]}']"
cmd = "bundle exec rake create_site:change_site_server_name[#{params[:id]},'#{params[:site_construct][:domain_name]}']"
system(cmd)
redirect_to :back and return
elsif params[:type] == 'delete_from_list'
@ -141,9 +141,9 @@ class Admin::SitePanelController < OrbitAdminController
else
Thread.new do
if params[:id].blank? && !params[:server_names].blank?
system("rake exec_commands:exec_commands[,'#{params[:commands]}',exec_all,'#{params[:server_names].join('////')}']")
system("bundle exec rake exec_commands:exec_commands[,'#{params[:commands]}',exec_all,'#{params[:server_names].join('////')}']")
else
system("rake exec_commands:exec_commands[#{params[:id]},'#{params[:commands]}',exec_commands]")
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},'#{params[:commands]}',exec_commands]")
end
end
end

View File

@ -77,7 +77,7 @@ namespace :create_site do
status = "closed"
end
end
site_constructs = SiteConstruct.where(:server_type => server_type , :domain_name.in => [server_name,*server_name_list]).all
site_constructs = SiteConstruct.where(:server_type => server_type , :domain_name.in => [server_name,*server_name_list]).to_a
site_construct = site_constructs[0]
Array(site_constructs[1..-1]).each do |s|
s.destroy